(PHP) Function to Ping RSS

potentialeight

Expert Gambling Writer
Oct 30, 2010
2,201
41
0
NC
www.potentialeight.com
I've thrown together the following function to ping an RSS feed to Pingomatic (and return the resulting page) as part of something I'm working on. It works, but is there anything that I should do to change it? Thanks. :)


PHP:
<?php

function pingrss($title, $url)
{
  $pingurl = "http://pingomatic.com/ping/?title=".urlencode($title)."&blogurl=urlencode".($url)."&rssgurl=".urlencode($url)."&chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogrolling=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_bloglines=on&chk_aiderss=on&chk_skygrid=on&chk_audioweblogs=on&chk_rubhub=on&chk_geourl=on&chk_a2b=on&chk_blogshares=on";
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch,CURLOPT_URL,$pingurl);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
  curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
  $data = curl_exec($ch);
  curl_close($ch);
  return $data;
}

?>