Re: [請益] 抓圖

看板PHP作者 (愁痕飄絮)時間16年前 (2008/08/14 20:05), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/5 (看更多)
用 file_get_contents() 即可,傳入圖片網址。 抓完後有兩個選擇,一是直接輸出給瀏覽器看,二是存檔到伺服器上。 $img = file_get_contents("http://de2.php.net/images/php.gif", 0); // 一 header('Content-Type: images/gif'); echo $img; // 二 $f = fopen("123php.gif", "w"); fwrite($f, $img); fclose($f); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.117.202.109
文章代碼(AID): #18f1-biG (PHP)
討論串 (同標題文章)
文章代碼(AID): #18f1-biG (PHP)