google ping 實現函數

function googleping ($blogname, $webaddress, $urladdress, $rssaddress, $categoryname) {        $url='http://blogsearch.google.com/ping/RPC2';        $trackback_url=parse_url($url);        $out="POST /ping/RPC2 HTTP/1.0\r\n";        $out.="Host: blogsearch.google.com\r\n";           $out.="Content-Type: text/xml\r\n";        $query_string="<?xml version=\"1.0\"?>\r\n<methodCall>\r\n<methodName>weblogUpdates.extendedPing</methodName>\r\n<params>\r\n<param>\r\n<value>{$blogname}</value>\r\n</param>\r\n<param>\r\n<value>{$webaddress}</value>\r\n</param>\r\n<param>\r\n<value>{$urladdress}</value>\r\n</param>\r\n<param>\r\n<value>{$rssaddress}</value>\r\n</param>\r\n<param>\r\n<value>{$categoryname}</value>\r\n</param>\r\n</params>\r\n</methodCall>";        $out.='Content-Length: '.strlen($query_string)."\r\n";        $out.="User-Agent: <a href='blog.51cto.com'>blog.51cto.com\r\n\r\n</a>";        $out.=$query_string;           $trackback_url['port']=80;           $fs=fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 10);           if (!$fs) return false;        fputs($fs, $out);        $http_response = '';        while(!feof($fs)) {         $http_response .= fgets($fs, 128);        }        @fclose($fs);        echo $http_response;        return true;       }
相關文章
相關標籤/搜索