<?php
/**
* Применение Google Image Api
* автор: Nc_SOft
* 25.11.09
*/
/*
Не знаю как вас, а меня изрядно подзаебали умники, продающие
"воздух" под громким названием глобальный поиск картинок
*/
$search = 'Сиськи Семенович';
$json = file_get_contents('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q='.urlencode($search).'&start=0');
$data = json_decode($json);
//смотрим с чем имеем дело
//print_r($data);
//и на вывод
?><div>результатов: <?=$data->responseData->cursor->estimatedResultCount;?></div>
<?php foreach ($data->responseData->results as $v) : ?>
<div><a href="<?=$v->unescapedUrl;?>"><img src="<?=$v->tbUrl;?>" /></a></div>
<?php endforeach;
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for ajax.googleapis.com failed: System error in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): Failed to open stream: php_network_getaddresses: getaddrinfo for ajax.googleapis.com failed: System error in /in/SLgn2 on line 14
<div>результатов:
Warning: Attempt to read property "responseData" on null in /in/SLgn2 on line 21
Warning: Attempt to read property "cursor" on null in /in/SLgn2 on line 21
Warning: Attempt to read property "estimatedResultCount" on null in /in/SLgn2 on line 21
</div>
Warning: Attempt to read property "responseData" on null in /in/SLgn2 on line 22
Warning: Attempt to read property "results" on null in /in/SLgn2 on line 22
Warning: foreach() argument must be of type array|object, null given in /in/SLgn2 on line 22
Output for 8.0.13 - 8.0.30
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): Failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
<div>результатов:
Warning: Attempt to read property "responseData" on null in /in/SLgn2 on line 21
Warning: Attempt to read property "cursor" on null in /in/SLgn2 on line 21
Warning: Attempt to read property "estimatedResultCount" on null in /in/SLgn2 on line 21
</div>
Warning: Attempt to read property "responseData" on null in /in/SLgn2 on line 22
Warning: Attempt to read property "results" on null in /in/SLgn2 on line 22
Warning: foreach() argument must be of type array|object, null given in /in/SLgn2 on line 22
Output for 8.0.0 - 8.0.12
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): Failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/SLgn2 on line 14
<div>результатов:
Warning: Attempt to read property "responseData" on null in /in/SLgn2 on line 21
Warning: Attempt to read property "cursor" on null in /in/SLgn2 on line 21
Warning: Attempt to read property "estimatedResultCount" on null in /in/SLgn2 on line 21
</div>
Warning: Attempt to read property "responseData" on null in /in/SLgn2 on line 22
Warning: Attempt to read property "results" on null in /in/SLgn2 on line 22
Warning: foreach() argument must be of type array|object, null given in /in/SLgn2 on line 22
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
<div>результатов:
Notice: Trying to get property 'responseData' of non-object in /in/SLgn2 on line 21
Notice: Trying to get property 'cursor' of non-object in /in/SLgn2 on line 21
Notice: Trying to get property 'estimatedResultCount' of non-object in /in/SLgn2 on line 21
</div>
Notice: Trying to get property 'responseData' of non-object in /in/SLgn2 on line 22
Notice: Trying to get property 'results' of non-object in /in/SLgn2 on line 22
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Output for 7.3.32 - 7.3.33, 7.4.26
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
<div>результатов: </div>
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/SLgn2 on line 14
<div>результатов:
Notice: Trying to get property 'responseData' of non-object in /in/SLgn2 on line 21
Notice: Trying to get property 'cursor' of non-object in /in/SLgn2 on line 21
Notice: Trying to get property 'estimatedResultCount' of non-object in /in/SLgn2 on line 21
</div>
Notice: Trying to get property 'responseData' of non-object in /in/SLgn2 on line 22
Notice: Trying to get property 'results' of non-object in /in/SLgn2 on line 22
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Output for 7.0.20, 7.1.5 - 7.1.33
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/SLgn2 on line 14
<div>результатов:
Notice: Trying to get property of non-object in /in/SLgn2 on line 21
Notice: Trying to get property of non-object in /in/SLgn2 on line 21
Notice: Trying to get property of non-object in /in/SLgn2 on line 21
</div>
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
<div>результатов:
Notice: Trying to get property of non-object in /in/SLgn2 on line 21
Notice: Trying to get property of non-object in /in/SLgn2 on line 21
Notice: Trying to get property of non-object in /in/SLgn2 on line 21
</div>
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Output for 5.2.6 - 5.2.17, 5.3.0 - 5.3.29
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
<div>результатов: <?=$data->responseData->cursor->estimatedResultCount;?></div>
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Output for 5.2.1 - 5.2.5
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Connection refused in /in/SLgn2 on line 14
<div>результатов: <?=$data->responseData->cursor->estimatedResultCount;?></div>
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Notice: Trying to get property of non-object in /in/SLgn2 on line 22
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Output for 5.2.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Connection refused in /in/SLgn2 on line 14
<div>результатов: <?=$data->responseData->cursor->estimatedResultCount;?></div>
Warning: Invalid argument supplied for foreach() in /in/SLgn2 on line 22
Output for 5.0.3 - 5.0.5, 5.1.0 - 5.1.6
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Connection refused in /in/SLgn2 on line 14
Fatal error: Call to undefined function json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Output for 5.0.1 - 5.0.2
Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Success in /in/SLgn2 on line 14
Fatal error: Call to undefined function json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Output for 5.0.0
Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Bad file descriptor in /in/SLgn2 on line 14
Fatal error: Call to undefined function json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Connection refused in /in/SLgn2 on line 14
Fatal error: Call to undefined function: json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Connection refused in /in/SLgn2 on line 14
Fatal error: Call to undefined function: json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Output for 4.3.5 - 4.3.9
Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Success in /in/SLgn2 on line 14
Fatal error: Call to undefined function: json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Output for 4.3.2
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0): failed to open stream: Connection refused in /in/SLgn2 on line 14
Fatal error: Call to undefined function: json_decode() in /in/SLgn2 on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: file_get_contents() [http://www.php.net/function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/SLgn2 on line 14
Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=%D0%A1%D0%B8%D1%81%D1%8C%D0%BA%D0%B8+%D0%A1%D0%B5%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B8%D1%87&start=0) [http://www.php.net/function.file-get-contents]: failed to create stream: Connection refused in /in/SLgn2 on line 14
Fatal error: Call to undefined function: json_decode() in /in/SLgn2 on line 15