Xml, Http Header And Technorati Ping - Help Needed

Status
Not open for further replies.


I'm trying to look at the link you posted, but it seems like Technorati's down.
 
Http headers are sent in http requests. To send a header from the server to a visitor in php do this.
header("name: content);
That technorati page didn't show up for me, but I guess that when you send a "ping", the server acts as a client instead. This function can be used for that. http://se.php.net/manual/sv/function.fsockopen.php
Watch the first example where they set 3 headers for example.
 
Ok now I can see that technorati page. My code here may contain some errors but i hope you get the idea:

PHP:
<?php
$fp = fsockopen("rpc.technorati.com", 80, $errno, $errstr, 30);
if (!$fp) {
   echo "$errstr ($errno)<br />\n";
} else {
    $out = "POST /rpc/ping HTTP/1.0\r\n";
    $out .= "User-Agent: YOUR AGENT HERE\r\n";
    $out .= "Host: rpc.technorati.com\r\n";
    $out .= "Content-Type: text/xml\r\n";
    $out .= "Content-length: [the exakt lenght (in chars) of the content that comes below i guess]\r\n\r\n"; // notice \r\n\r\n on the last header
$out .= "<?xml version="1.0"?>
<methodCall>
  <methodName>weblogUpdates.ping</methodName>
  <params>
    <param>
      <value>YOUR WEBLOG NAME HERE</value>
    </param>
    <param>
      <value>http://www.YOURWEBLOGURL.com/</value>
    </param>
  </params>
</methodCall>"

   fwrite($fp, $out);
   while (!feof($fp)) {
       echo fgets($fp, 128);
   }
   fclose($fp);
}
?>
 
Status
Not open for further replies.