PageRank con PHP y cURL

Interesante código que hace uso de PHP y cURL (de lo cual comentamos anteriormente) para obtener el PageRank de cierto sitio web. Recuerda tener instalada y activada la librería libcurl.

Código:

<?
function cURL($url, $header, $cookie, $p)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_NOBODY, $header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($p) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
}
;
$result = curl_exec($ch);
curl_close($ch);
if ($result) {
return $result;
} else {
return curl_error($ch);
}
;
}
;
if(isset($_GET['url']))
{
$rank=cURL("http://dlls.info/results.php?url=".$_GET['url'],0,0,null);
echo $rank;
echo "
<form method=get target=rank.php>
URL:<input type=text name=url><input type=submit value=Submit>
";
}
else
{
?>
<form method=get target=rank.php>
URL:<input type=text name=url>
<input type=submit value=Submit>
<?
}
?>

Créditos 84Productions

One thought on “PageRank con PHP y cURL

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Wanderz Blog by Crimson Themes.