1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Page Ranking

Discussion in 'White Hat SEO' started by trancecommunity, Jul 19, 2010.

  1. trancecommunity

    trancecommunity Regular Member

    Joined:
    Feb 11, 2010
    Messages:
    269
    Likes Received:
    35
    Whats the best way of checking how my URL is performing for a certain keyword?
     
  2. aReJay

    aReJay Power Member

    Joined:
    Apr 29, 2009
    Messages:
    736
    Likes Received:
    237
    Location:
    Down under
    PHP:
    <?
    set_time_limit );
    if (isset ( 
    $_POST [query] )) {
        
    ////BUILD THE GOOGLE URL
        

        
    $query urlencode $_POST ['query'] );
        
        
    $url "http://www.google.com/search?q=" $query "&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&num=100&start=";
        
    ////END OF GOOGLE URL BUILD
        //GET DATA URLS
        
    for($i 0$i 1001$i $i 100) {
            
    $data curl $url $i );
            
    //echo $data;
            

            
    preg_match_all "/<h3 class=\"r\"><a href=\"(.*?)\"/"$data$matches );
            foreach ( 
    $matches [1] as $line ) {
                
    $match [] = $line;
            }
        }
        echo 
    "Found <b>" count $match ) . "</b> results for <b>" $_POST ['query'] . "</b><br>";
        print 
    implode "<br>"$match );

    } else {
        
    ?>
    <form action="serp_scraper.php" method="post">
    <table>
        <tr>
            <td>Query:</td>
            <td><input type="text" name="query" value="<?
        echo $must_box;
        ?>" /></td>
        </tr>
    </table>
    </form>
    <?
    }

        function curl($url) {
            $ch = curl_init ();
            curl_setopt ( $ch, CURLOPT_URL, $url );
            curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
            curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 );
            
            $data = curl_exec ( $ch );
            
            //    $data = file_get_contents($url);
            

            return $data;
        }

    ?>