The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 22, 2019, 07:52:51 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Top Paying Adsense Keyword Parser  (Read 2786 times)
jsp123
Rookie
**
Offline Offline

Posts: 20


View Profile
« on: May 20, 2007, 11:42:47 AM »

Something I whipped up today, grabs the keywords from rumler.com. Right now it just prints the keywords out to the screen, but it could easily be changed. All the data is saved in the $results array.  Good Luck!

Code:
<?php

function rawdata($letter 'A'$pn '1'){
set_time_limit(10);
 // setup and configure
$ch curl_init();
$randnum rand(1,9999999);
curl_setopt($chCURLOPT_COOKIEJAR"/tmp/cookiejar-$randnum");
curl_setopt($chCURLOPT_COOKIEFILE"/tmp/cookiejar-$randnum");
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_POST0);
curl_setopt($chCURLOPT_URL,"http://www.rumler.com/google/adsense/top-paying-keywords.php?show=$pn&letter=$letter&sort=AvgCPC");
return curl_exec($ch);
}

function 
int2alpha($int_wert) {
    if(
$int_wert == 26){
    
return 'Z';
    }
    
    if(
$int_wert%26>=1) {
        
$alpha_string=chr(($int_wert%26)+64).$alpha_string;
        
$alpha_string=int2alpha($int_wert/26).$alpha_string;
    }

    
return $alpha_string;

    
}

function 
keywords($data){
//echo $data;
$info = array();

preg_match_all("/<tr align=\"left\"><td width=\"5%\">&nbsp;<\/td><td width=\"20%\" valign=\"top\">(.*?)<\/td><td width=\"5%\">&nbsp;<\/td><td width=\"20%\">(.*?)<\/td><td width=\"50%\">(.*?)<\/td><\/tr>/"$data$info);

return $info;
}

function 
recordnum($data){

preg_match("/<span class=\"arial\">Found (.*?)<i>Google Adsense Top Paying Keywords<\/i>/"$data,$number);

return 
trim($number[1]);
}

for(
$char 1;$char<=26;$char++){

$c int2alpha($char);
$data rawdata($c,1);

$pages ceil(recordnum($data)/25);

echo "<h2><em>Keywords for</em> $c:</h2>\n";


for($page 1;$page<=$pages;$page++){

$data rawdata($c,$page);

$info keywords($data);
$count 0;

foreach($info[1] as $max){

//I just wanted the keywords so I didnt clutter the results page with the max/avg bid amounts
$results[$c]['max'][] = $max;
$results[$c]['avg'][] = $info[2][$count];
$results[$c]['keyword'][] = $info[3][$count];
//remove and use the results array at the bottom if you want to use for something else
echo $info[3][$count]."<br>\n";
$count++;
}

}


}

//print_r($results);

?>
« Last Edit: May 20, 2007, 01:33:54 PM by jsp123 » Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: May 20, 2007, 11:59:52 AM »

Nice - I've never been there. Handy thing to have

Thanks JSP!
/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
m0nkeymafia
Expert
****
Offline Offline

Posts: 240


Check it!


View Profile
« Reply #2 on: May 21, 2007, 01:23:22 AM »

Wow thats a pretty cool script and idea!
It might be very much worth making a selective filter for it

So you can perhaps pass it one or two words, and it picks out the most related match.

This way you can better target high paying keywords whilst staying on topic

Coolios
Logged

I am Tyler Durden
basura
Rookie
**
Offline Offline

Posts: 13


View Profile
« Reply #3 on: June 14, 2007, 08:31:16 AM »

Wow thats a pretty cool script and idea!
It might be very much worth making a selective filter for it

So you can perhaps pass it one or two words, and it picks out the most related match.

This way you can better target high paying keywords whilst staying on topic

Coolios



Ummmh, could you put a living example of this thing please?

Thanks! ^_^

Slime
Logged

No links in signatures please
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!