SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to using SoapClient in php5 with google api

    hi,

    i want to using google search api
    i have license key but when i using this

    PHP Code:
    $client = new SoapClient("http://api.google.com/search/beta2");
    $faxResult $client->SendCharFax(array(
            
    "key"        => 'keyhere',
            
    "q"           => 'test',                 
            
    "start"       => '0',
            
    "maxResults"  => '10',
            
    "filter"      => true,
            
    "restrict"    => "",
            
    "safeSearch"  => true,
            
    "lr"          => "lang_en",
            
    "ie"          => "",
            
    "oe"          => ""
    ));

    print_r($faxResult); 
    i get this error

    Code:
    Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://api.google.com/search/beta2' : Extra content at the end of the document in /home/arabsb5/public_html/soft/test.php:13 Stack trace: #0 /home/**/public_html/**/test.php(13): SoapClient->SoapClient('http://api.goog...') #1 {main} thrown in /home/**/public_html/**/test.php on line 13
    what should i do

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Code:
    http://api.google.com/search/beta2
    Is not a valid WSDL, which is what your require for the SoapClient to function correctly. Unfortunately, Google appears to have ceased to provide this service.

    You could always look to consume Google's AJAX API which provides a json encoded response.

    Code:
    http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={QUERY}
    More information here.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •