The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 21, 2019, 01:43:47 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: [PHP] Very simple mass backlink checker from yahoo site explorer  (Read 2576 times)
jsp123
Rookie
**
Offline Offline

Posts: 20


View Profile
« on: September 07, 2007, 02:29:37 AM »

Save as urls.php. Be safe, don't change the sleep time Tongue  I will make a scraper for some domain lists next so people can add onto it.   

Code:
<?php  

function doRequest($method$url$referer$vars) {
set_time_limit(0);
    
$method strtoupper(trim($method));
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
    if(
$referer){
    
curl_setopt($chCURLOPT_REFERER$referer);
    }
    
    
curl_setopt($chCURLOPT_HEADER1);
    
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
    
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
//curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookiejar');
    //curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookiejar');
    
    
if ($method == 'POST') {
        
curl_setopt($chCURLOPT_POST1);
        
curl_setopt($chCURLOPT_POSTFIELDS$vars);
    }
    
    
$data curl_exec($ch);
    
curl_close($ch);
    
    if (
$data) {
            return 
$data;
    } else {
        return 
curl_error($ch);
    }
}
function 
get($url$referer) {
    return 
doRequest('GET'$url$referer'NULL');
}
function 
post($url$referer$vars) {
    return 
doRequest('POST'$url$referer$vars);
}
function 
getbacklink($domain){

$page get("http://siteexplorer.search.yahoo.com/advsearch?p=http%3A%2F%2F$domain&bwm=i&bwmo=&bwmf=s""");

return $page;
}

function 
blstats($list){
echo 
"<div id=\"results\">";
echo "<ul>\n";
foreach($list as $l){
sleep(2);
$bl getbacklink($l);

preg_match("#of about <strong>(.*?)</strong>#"$bl$match);

$count $match[1];

echo "<li class=\"domain\">$l</li><li class=\"backlinks\">$count</li>\n";
flush();
}
echo "</ul>\n";
echo "</div>\n";
}

function 
array_trim(&$value)
{
    
$value trim($value,"\n\t\r\h\v\0 ");
}

$style "#form{width: 275px; background: #ececec; padding: 0 30px 30px 30px; float: left;}
#results{float: left; display: block;}
ul{list-style: none;}
li{padding:10px; border-bottom: #ccc 1px solid;}
li.domain{float: left;width: 200px;}
li.backlinks{font-weight:bold;}
h3{margin: 0 0 0 30px; font-size: 32px; color: #ccc;}
#form h3{color: #666; font-size: 18px; margin: 5px;}
#form h3 span{color: #ff0000; font-size: 12px;}"
;
echo 
"<style>$style</style>";
echo 
"<h3>Mass Backlink Checker</h3>\n<ul>\n";

echo 
"<div id=\"form\">\n<form action=\"urls.php\" method=\"POST\">\n
<h3>List domains below <span class=\"notice\">(one per line)</span></h3>
<textarea name=\"list\" cols=\"30\" rows=\"35\">digg.com\r\nebay.com</textarea><br />
<input name=\"submit\" type=\"submit\" value=\"sumbit\">
</form></div>"
;
if(
trim($_REQUEST['list'])){
$rlist trim($_REQUEST['list']);

$rlist str_replace("\r""\n"str_replace("\r\n""\n"$rlist));
$list explode("\n"$rlist);
//var_dump($fruit);

array_walk($list'array_trim');
blstats($list);
} else {
echo 
"<div id=\"results\"><span id=\"error\">Please Enter Some Domains</span></div>";
}
?>

Logged

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

Posts: 10096



View Profile
« Reply #1 on: September 09, 2007, 01:20:56 PM »

Good stuff JSP, thanks!

/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: September 10, 2007, 01:00:36 AM »

I like things like this cos it spurs you on to reuse the code
Logged

I am Tyler Durden
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!