I'm trying to get ANYTHING out of google
 API (for now), but it doesn't let me. I use 
 the SOAP_Client from PEAR project and the WDSL
 file you get from Google when you register your
 key for using with their API.

        When I give an action wrong parameters,
 everything works great, it complaints that
 I gave it wrong data. I provide RIGHT data
 then and...I get a blank screen. No errors in
 logs, no nothing. What can be wrong? All I
 did to downloaded from PEAR files was to change
 include paths so I could place all the required
 files in one directory (SOAP).

        The short test code follows (as you 
 can see I tried the doGoogleSearch action,
 defined in the WDSL, too). It looks like it
 bombs even before the first echo...:

        Help me, I'm really depressed and
 frustrated now :8[. I hate it when it doesn't
 give any kind of feedback like this...

<?
require_once('SOAP/Client.php');
$key = 'my google key goes here';
$queryterms = 'marichuana';
/*
$query = array( 
                'key' => $key,
                'q' => $queryterms, 
                'start' => 0, 
                'maxResults' => 10, 
                'filter' => true, 
                'restrict' => '', 
                'safeSearch' => false, 
                'lr' => '', 
                'ie' => '', 
                'oe' => '' 
              ); 
*/
$query = array( 
                'key' => $key,
                'phrase' => $queryterms
              ); 
$soapclient = new SOAP_Client('GoogleSearch.wsdl', true);
$result = $soapclient -> call('doSpellingSuggestion', $query);
echo '<pre>' . print_r($result, TRUE) . '</pre>';
$i = 1;
print("Top 10 results for <strong>$queryterms</strong><br /><br />");
foreach ($result as $key => $value) 
{
  if($key == 'resultElements') 
  {
    foreach ($value as $key2 => $value2) 
    {
      foreach($value2 as $key3 => $value3) 
      { 
        if($key3 == 'URL') 
        {
          $snippet = substr(strip_tags($value2["snippet"]), 0, 70);
          $summary = substr($value2["snippet"], 0, 70);
          $title = substr(strip_tags($value2["title"]), 0, 70);
          $cachedSize = $value2["cachedSize"];
          print("#$i: <strong><a href=\"$value3\">$title</a></strong><br />Summary: 
$summary<br />$value3 - $cachedSize<hr />");
          $i++;
        }
        print("$key3 $value3<br>");
      }
    }
  }
  print("Key: $key; Value: $value<br>\n");
}
?>
-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa    )   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to