我试图提取路段第一次出现的启动这样PHP提取链接的第一次出现在源代码
https://encrypted-tbn3.gstatic.com/images?...
从页面的源代码。该链接的开始和结尾的”这是我到目前为止已经有:。
$search_query = $array[0]['Name'];
$search_query = urlencode($search_query);
$context = stream_context_create(array('http' => array('header' => 'User-Agent: Mozilla compatible')));
$response = file_get_contents("https://www.google.com/search?q=$search_query&tbm=isch", false, $context);
$html = str_get_html($response);
$url = explode('"',strstr($html, 'https://encrypted-tbn3.gstatic.com/images?'[0]))
然而$网址的输出是不是我尝试提取链接,但非常不同的东西我已经加入了图像。
谁能解释输出给我,我怎么会得到所需的链接?谢谢