|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-07-27 10:22 UTC] khalid at pixelcraze dot com
Description:
------------
Randomly, the script will produce a fatal error. I am not sure if this is to do with the Services_Google, or whether it is a PHP Soap issue...
Reproduce code:
---------------
$google = new Services_Google($key);
$google->queryOptions['limit'] = 1000;
$google->search('"'.$keyword.'"');
$googleRes = $google->numResults();
Expected result:
----------------
I expect the results to appear. However, randomly, a fatal error is thrown. Most of the time, it will work. It is only when processing a few hundred queries at a time...
Actual result:
--------------
PHP Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in /usr/local/lib/php/Services/Google.php:203
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://api.goog...', 'urn:GoogleSearc...', 1, 0)
#1 [internal function]: SoapClient->__call('doGoogleSearch', Array)
#2 /usr/local/lib/php/Services/Google.php(203): SoapClient->doGoogleSearch('key...', '"sapphire3d.co....', 0, 10, true, '', true, '', '', '')
#3 /usr/local/lib/php/Services/Google.php(155): Services_Google->runQuery()
#4 /path/file.php(77): Services_Google->numResults()
#5 {main}
thrown in /usr/local/lib/php/Services/Google.php on line 203
Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in /usr/local/lib/php/Services/Google.php:203
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://api.goog...', 'urn:GoogleSearc...', 1, 0)
#1 [internal function]: SoapClient->__call('doGoogleSearch', Array)
#2 /usr/local/lib/php/Services/Google.php(203): SoapClient->doGoogleSearch('key...', '"sapphire3d.co....', 0, 10, true, '', true, '', '', '')
#3 /usr/local/lib/php/Services/Google.php(155): Services_Google->runQuery()
#4 /path/file.php(77): Services_Google->numResults()
#5 {main}
thrown in /usr/local/lib/php/Services/Google.php on line 203
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 22:00:01 2025 UTC |
Script requires Pear://Services_Google and a google API Key from www.google.com/api/ <?php require_once("Services/Google.php"); $key = "Google_Key"; for($i=1;$i<200;$i++) { $google = new Services_Google($key); $google->queryOptions['limit'] = 1000; $google->search('"page '.$i.'"'); $googleRes = $google->numResults(); echo "$i: $googleRes\n"; } ?> THe issue is that sometimes this script will run fine. Another time, the script will die at random intervals...