HTTP Error: Couldn't open socket connection to server |
|
hi all,
I am getting the following error while i tried to implement the google api .. Constructor error HTTP Error: Couldn't open socket connection to server http://www.api.google.com/GoogleSearch.wsdl prior to connect(). This is often a problem looking up the host name. Error HTTP Error: Couldn't open socket connection to server http://www.api.google.com/GoogleSearch.wsdl prior to connect(). This is often a problem looking up the host name. I am not using any firewall or proxy .Tell what are the changes i have to make .. Thanks in advance.Please reply asap its very urgent. URS Ram Prasath. |
||||||||||||
|
Site Admin
|
Error message is right
HOST name in the URL is wrong. |
||||||||||||
_________________ The PHP IDE team |
|
hi dmitri,
i have tried for , http://www.api.google.com/GoogleSearch.wsdl and http://api.google.com/GoogleSearch.wsdl i am getting the same error, Please let me know what is the correct url to access the google api.. Thank u Ram Prasath.R |
||||||||||||
|
Site Admin
|
http://api.google.com/GoogleSearch.wsdl is correct, first one is not.
if correct url still does not work, check your local firewall settings for the application (php.exe if you run from PhpED). |
||||||||||||
_________________ The PHP IDE team |
Site Admin
|
Google API works perfectly for 1000s customers using nusoap, it's a known fact.
Regarding your problem, it's a pure networking problem. You just have to adjust your firewall setting. Please consult with Symantec if you use their product and it stops your soap application from working. You may consult with Microsoft if it's XP's fireall blocks you. But sorry, there is nothing I could help you with this |
||||||||||||
_________________ The PHP IDE team |
|
Thank you dmitri,
Please do me a favour , here by i have enclosed my code for ur reference ...please try to run from ur machine and tell me the result...please do this for me.. Thank u very much my client code: <html> <head> <title>googly.php</title> </head> <body> <? require_once('../nusoap/lib/nusoap.php'); # Set parameters $parameters = array( 'key'=>'key here', // 'q' => $HTTP_GET_VARS['query'], 'q' => 'asdf', 'start' => '0', 'maxResults' => '10', 'filter' => 'false', 'restrict' => '', 'safeSearch' => 'false', 'lr' => '', 'ie' => '', 'oe' => '' ); //$soapoptions = array('namespace' => 'urn:GoogleSearch','trace' => 0); # Create a new SOAP client, feeding it GoogleSearch.wsdl on Google's site $soapclient = new soapclient('http://api.google.com/GoogleSearch.wsdl'); $results = $soapclient->call('doGoogleSearch',$parameters,'urn:GoogleSearch'); $err = $soapclient->getError(); if ($err) { // Display the error echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; // At this point, you know the call that follows will fail } //$proxy = $soapclient->getProxy(); # query Google //$results = $proxy->doGoogleSearch($parameters); if ($soapclient->fault) { echo '<h2>Fault</h2><pre>'; print_r($results); echo '</pre>'; } else { // Check for errors $err = $soapclient->getError(); if ($err) { // Display the error echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { // Display the result echo '<h2>Result</h2><pre>'; print_r($results); echo '</pre>'; } } # Results? if (is_array($results['resultElements']) ) { print "<p>Your Google query for '" . $_POST['search']. "' found " .print_r($results) . $results['estimatedTotalResultsCount'] . " results, the top ten of which are:</p>"; foreach ( $results['resultElements'] as $results ) { "<p><a href='" . $results['URL'] . "'>" . ( $results['title'] ? $results['title'] : 'no title' ) . "</a><br />" . $results['URL'] . "<br />" . ( $results['snippet'] ? $results['snippet'] : 'no snippet' ) . "</p>"; } } # No Results else { print "Your Google query for '" . $_POST['search'] . "' returned no results"; } //Display the request and response echo '<h2>Request</h2>'; echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>'; echo '<h2>Response</h2>'; echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>'; // Display the debug messages echo '<h2>Debug</h2>'; echo '<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>'; ?> </body> </html> Ram Prasath |
||||||||||||
|
Site Admin
|
your code works pretty good there.
The only little glitch should be corrected is $soapclient = new soapclient('http://api.google.com/GoogleSearch.wsdl'); => $soapclient = new soapclient('http://api.google.com/GoogleSearch.wsdl', 'wsdl'); but it gets Google's responce without this correction too. still, you are getting problem with your network, not with code or library. |
||||||||||||
_________________ The PHP IDE team |
|
Thank you very much for your effort ..Let me check out with my network connections
Thanks again.. Ram Prasath.R |
||||||||||||
|
Site Admin
|
FYI, if you have Norton firewall, check the list of all applications in Internet Access Control tab, locate all with PHP icon and set "Permit all" or approriate custom settings for them.
|
||||||||||||
_________________ The PHP IDE team |
|
Thank u ..
Thank u very much Ram Prasath.R |
||||||||||||
|
HTTP Error: Couldn't open socket connection to server |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by