Пингуем technorati
Декабрь 20th, 2007 | by Chippa |Скрипт пингования технорати.
__________________________________
<?php
$blogname = «Архиофигенный блог»;
$blogurl = «xttp://blogoff.net/»;
# Using the XML-RPC extension to format the XML package
$request = xmlrpc_encode_request(«weblogUpdates.ping», array($blogname, $blogurl) );
# Using the cURL extension to send it off,
# first creating a custom header block
$header[] = «Host: rpc.technorati.com»;
$header[] = «Content-type: text/xml»;
$header[] = «Content-length: «.strlen($request) . «\r\n»;
$header[] = $request;
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, «http://rpc.technorati.com/rpc/ping»); # URL to post to
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); # return into a variable
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); # custom headers, see above
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, ‘POST’ ); # This POST is special, and uses its specified Content-type
$result = curl_exec( $ch ); # run!
curl_close($ch);
echo $result;
?>
__________________________________
php5, curl, xml
You must be logged in to post a comment.