How do I get images from a specific site inside html content?
如何从html内容中的特定网站获取图像?
See the example here .
请参阅此处的示例。
Here http://www.techtunes.com.bd/android-apps/tune-id/214272 is the main post link. I'm scraping content inside div#content using php. But images in the post give 403.
这里http://www.techtunes.com.bd/android-apps/tune-id/214272是主要的帖子链接。我正在使用php抓取div内容中的内容。但是帖子中的图片给出了403。
How do I show that image? I'm using the Goutte Library
如何显示该图像?我正在使用古特图书馆
1 个解决方案
#1
0
use it like this: call the function with $url the image path, and $filename the image stored path.
像这样用它:用$ url调用图像路径的函数,用$ filename图像存储路径。
private function httpgetfile($url, $filename)
{
$fp = fopen($filename, 'a+');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
return;
}
#1
0
use it like this: call the function with $url the image path, and $filename the image stored path.
像这样用它:用$ url调用图像路径的函数,用$ filename图像存储路径。
private function httpgetfile($url, $filename)
{
$fp = fopen($filename, 'a+');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
return;
}