1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

A problem with API SERP

Discussion in 'Google API' started by Pushilin, May 14, 2010.

  1. #1
    Hi,

    we found, that Google Search API SERP differs from organic results on Google.com. Don't you know how to take true statistics via Google search API?

    thanks!
     
    Pushilin, May 14, 2010 IP
  2. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #2
    It is like 3 times fewer in google API, right ?

    did you manage to retrieve also result pages cursor? in order to display current search result page and next ones 1, 2, 3.....10 NEXT !

    regards,
    Radu
     
    shmekerosu, May 14, 2010 IP
  3. amirjaan

    amirjaan Peon

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    its near impossible for me to do that
     
    amirjaan, May 20, 2010 IP
  4. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #4
    but how you move to next result pages ???
     
    shmekerosu, Jun 23, 2010 IP
  5. jtGraphic

    jtGraphic Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I have a serps script I've been working on - far from perfect, but it's a start if you know PHP. I'm not kidding. I literally just copied and pasted this, except I deleted my proxies. You'll need to find your own.

    
    
    <pre>
    SERPS THANG
    <?php
    
    echo "\n";
    
    $proxies = array(
    	//get your own proxies
    );
    
    function getPage($proxy, $url, $referer, $agent, $header, $timeout) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, $header);
    	curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
    	curl_setopt($ch, CURLOPT_PROXY, $proxy);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_REFERER, $referer);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
     
        $result['EXE'] = curl_exec($ch);
        $result['INF'] = curl_getinfo($ch);
        $result['ERR'] = curl_error($ch);
     
        curl_close($ch);
     
        return $result;
    }
    
    function get_a_href($file){
        $h1count = preg_match_all('/(<h3 class="r"><a href=")(.*?)(")/i',$file,$patterns);
        return $patterns[2];
    }
    
    $proxy = $proxies[rand(0,sizeof($proxies) - 1)];
    
    echo "from: ".$proxy."\n";
    
    for($i=0; $i<=15; $i++) {
    	$request_url = 'http://www.google.com/search?q='.$_GET['q'].'&start='.$i*10;
    	
    	$result = getPage(
    		$proxy,
    		$request_url,
    		'http://www.google.com/',
    		'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8',
    		1,
    		5
    	);
    	 
    	if (empty($result['ERR'])) {
    		$matches['urls'] = get_a_href($result['EXE']);
    		
    		if(sizeof($matches['urls']) > 0) {
    			foreach($matches['urls'] as $match) {
    				$urls[] = $match;
    			}
    		} else {
    			echo $result['EXE'];
    		}
    	} else {
    		echo $result['ERR'].$proxy;
    	}
    }
    
    if(sizeof($urls) > 0) {
    	$in_results = false;
    
    	foreach($urls as $key => $url) {
    		if(strpos($url,str_replace(' ','.',$_GET['site'])) > -1) {
    			$in_results = $key + 1;
    		} else {
    			//'FAIL';
    		}
    	}
    	
    	if($in_results > 0) {
    		echo "You're at postion number: ".$in_results;
    	} else {
    		echo "You're not in the SERPS.\n";
    		echo $_GET['q'];
    	}
    } else {
    	echo 'URLS: \n\n'.print_r($urls,true).'\n';
    }
    ?>
    </pre>
    
    PHP:
     
    jtGraphic, Jul 7, 2010 IP
  6. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #6
    super, thanks for posting, I will check it for sure.

    why you need to use proxies ? I have a API key, why you are not using a key to avoid proxies ? (I am curious).

    All the best!
     
    shmekerosu, Jul 12, 2010 IP
  7. jtGraphic

    jtGraphic Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Google doesn't allow SERPS through the API as far as I know. They run a captcha if you hit the page too much, so proxies spread it out a bit.
     
    jtGraphic, Jul 18, 2010 IP
  8. foresee2010

    foresee2010 Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    o no what is this ?
     
    foresee2010, Jul 21, 2010 IP
  9. Michael smith

    Michael smith Peon

    Messages:
    313
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    yes u r right peon.
     
    Michael smith, Aug 2, 2010 IP
  10. iMarketingGuru

    iMarketingGuru Well-Known Member

    Messages:
    486
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    160
    #10
    Yeah proxies are necessary when using most of their APIs, it's crappy but the work and pho scripts definitely do work - the key languages are php, mysql, Ajax and XML data (for the API callbacks)
     
    iMarketingGuru, Aug 9, 2010 IP
  11. iMarketingGuru

    iMarketingGuru Well-Known Member

    Messages:
    486
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    160
    #11
    Stop spamming with great subject - add something to the conversation or you could easily get banned fast by any reports to dp :(
     
    iMarketingGuru, Aug 11, 2010 IP
  12. Websys_seo

    Websys_seo Peon

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I have been trying this from a long time, but collecting SERP results online is next to impossible. I will look into the script....BUT WHAT PROXY YOU ALL ARE TALKING ABOUT....plzz let me know as i need this.
     
    Websys_seo, Sep 22, 2010 IP
  13. aion4217

    aion4217 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    how to take true statistics via Google search API?
     
    aion4217, Sep 30, 2010 IP
  14. Pramono Tunggul

    Pramono Tunggul Member

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #14
    Nice info dude, Gonna try it right away.
     
    Pramono Tunggul, Oct 18, 2010 IP
  15. aion4217

    aion4217 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Don't you know how to take true statistics via Google search API?
     
    aion4217, Oct 19, 2010 IP