如何从PHP或Jquery或两者中的URL获取图像?

问题描述:

有人可以告诉我,如何仅通过其网址获取特定网站的图片?就像在google搜索页面上所做的那样.我搜索过网络,但没有得到满意的答复.

Can anybody tell me, how can I get image for a particular site by its url only? As that is done on the google search page. I have searched web but I didn't get any satisfactory ans.

我不是体验开发人员,所以我只是尝试 该代码只能获取第一张图片

I'm Not Experience Developer so i just try This Code can fetch only first image

<?php
$url = 'http://*.com/questions/7994340/how-can-i-get-image-from-url-in-php-or-jquery-or-in-both';
$data = file_get_contents($url);

if(strpos($data,"<img"))
{
    $imgpart1 = explode('<img src=',$data);
    $imgpart2 = explode('"',$imgpart1[1]);
    echo "<img src=".$imgpart2[1]." />";
}
?>