View Single Post
  #10 (permalink)  
Old 05-19-06, 08:43 PM
klaniak klaniak is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Underground
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mab
I'm with Keith, having $uri= as part of a print/echo in that for loop makes no sense. The $uri variable is not referenced within that loop.

You state this worked before you made some changes. Post the before code so someone here can zero in on what might be causing this.

The resultElements is an index name, try enclosing it in single quotes - $searchresults['resultElements']...

It would be interesting to see the results of this -
PHP Code:

echo "<pre>";

print_r($searchresults); 
echo 
"</pre>"
Could you post or attach a screen shot of this?
the code was the same as be4

PHP Code:

 for($a=0;$a<5;$a++)

{
$params = array(
'key' => 'your api key',
'q' => 'mp3 player'
'start' => $res,
'maxResults' => 10,
'filter' => false,
'restrict' => '',
'safeSearch' => false,
'lr' => 'lang_en',
'ie' => '',
'oe' => ''
);

$soapclient = new soapclient("http://api.google.com/search/beta2");
$searchresults $soapclient->call("doGoogleSearch"$params,"urn:GoogleSearch""urn:GoogleSearch");
//print_r($searchresults);
// echo $uri=$searchresults[resultElements][$i][URL].'<br>';

for($i=0;$i<10;$i++)
{

print 
$uri=$searchresults[resultElements][$i][URL].'<br>';
flush();
}
echo 
'<br><br>';
$res+=10;

I modified the value of $a
in the for loop
for($a=0;$a<5;$a++)
I put here 10 and 6 and 7
when I modified this value the error camed:
I could see 20 links and then fatal error...
I know it works because it worked the first time...
Maybe I sould do a xml request that would work much better (I think)
The thing is that I build this code and as a writer of it: It's buggy and it drives me crazy, it should work like a daydream.

About $uri Neah $uri has nothing to do with it.
I did an echo $searchresults[resultElements][$i][URL].'<br>'; b4 and it did the same, until now the code has suffered lots of modification, I mean I posted only the loop. I will come with the function
Reply With Quote