Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-16-2010, 10:00 AM   PM User | #1
kapitanluffy
New to the CF scene

 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
kapitanluffy is an unknown quantity at this point
Question Retrieving Google Search Results

i have this code, it succesfully retrieves the search results from google. the only problem is it only retrieves a limited number of results. unlike when you are searching the same query in the google page. the results are more than the results given by the code

are there any other way to retrieve google results?

*mi first post pls be kind to me :innocent:


PHP Code:
    $search 'query';
    
$obj json_decodefile_get_contents'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&q=' urlencode$search ) ) );
            foreach(
$obj ->responseData->results as $i){
                echo 
$i->unescapedUrl.'<br/>';
            }
    } 
kapitanluffy is offline   Reply With Quote
Old 08-16-2010, 10:03 AM   PM User | #2
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
From what is posted above... no $obj contains all the data retrieved from the api and the foreach goes through all the results in obj.
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Old 08-16-2010, 11:59 AM   PM User | #3
kapitanluffy
New to the CF scene

 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
kapitanluffy is an unknown quantity at this point
Smile

Quote:
Originally Posted by Phil Jackson View Post
From what is posted above... no $obj contains all the data retrieved from the api and the foreach goes through all the results in obj.
actually sir try pasting
Code:
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&q=search
to your address bar. it will give you a response which becomes the value for $obj

to view it properly
Code:
<pre>
<?php echo $obj; ?>
</pre>

Last edited by kapitanluffy; 08-16-2010 at 11:59 AM.. Reason: wrong code
kapitanluffy is offline   Reply With Quote
Reply

Bookmarks

Tags
google, result, retrieve, scrape, search

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:09 AM.


Advertisement
Log in to turn off these ads.