Posted By

ginoplusio on 02/24/10


Tagged

web xml-rpc spider XMLRPC service pingomatic ping-o-matic


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ginoplusio


Call ping-o-matic service with PHP


 / Published in: PHP
 

URL: http://www.barattalo.it/2010/02/24/ping-pingomatic-com-services-with-php/

This function calls pingomatic rpc service to increase traffic to your site. More info and instructions on Barattalo blog. .

  1. function pingomatic($title,$url,$debug=false) {
  2. $content='<?xml version="1.0"?>'.
  3. '<methodCall>'.
  4. ' <methodName>weblogUpdates.ping</methodName>'.
  5. ' <params>'.
  6. ' <param>'.
  7. ' <value>'.$title.'</value>'.
  8. ' </param>'.
  9. ' <param>'.
  10. ' <value>'.$url.'</value>'.
  11. ' </param>'.
  12. ' </params>'.
  13. '</methodCall>';
  14.  
  15. $headers="POST / HTTP/1.0
  16. ".
  17. "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)
  18. ".
  19. "Host: rpc.pingomatic.com
  20. ".
  21. "Content-Type: text/xml
  22. ".
  23. "Content-length: ".strlen($content);
  24.  
  25. if ($debug) nl2br($headers);
  26.  
  27. $request=$headers."
  28.  
  29. ".$content;
  30. $response = "";
  31. $fs=fsockopen('rpc.pingomatic.com',80, $errno, $errstr);
  32. if ($fs) {
  33. fwrite ($fs, $request);
  34. while (!feof($fs)) $response .= fgets($fs);
  35. if ($debug) echo "<xmp>".$response."</xmp>";
  36. fclose ($fs);
  37. preg_match_all("/<(name|value|boolean|string)>(.*)<\/(name|value|boolean|string)>/U",$response,$ar, PREG_PATTERN_ORDER);
  38. for($i=0;$i<count($ar[2]);$i++) $ar[2][$i]= strip_tags($ar[2][$i]);
  39. return array('status'=> ( $ar[2][1]==1 ? 'ko' : 'ok' ), 'msg'=>$ar[2][3] );
  40. } else {
  41. if ($debug) echo "<xmp>".$errstr." (".$errno.")</xmp>";
  42. return array('status'=>'ko', 'msg'=>$errstr." (".$errno.")");
  43. }
  44. }

Report this snippet  

You need to login to post a comment.