My host doesn't allow fsockopen, but it does allow curl. I'm happy using curl from the cli, but haven't had to use it with PHP much. How do I write this using curl instead?
$xmlrpcReq and Length are defined earlier.
$host = "http://rpc.pingomatic.com/";
$path = "";
$httpReq = "POST /" . $path . " HTTP/1.0\r\n";
$httpReq .= "User-Agent: My Lovely CMS\r\n";
$httpReq .= "Host: " . $host . "\r\n";
$httpReq .= "Content-Type: text/xml\r\n";
$httpReq .= "Content-length: $xmlrpcLength\r\n\r\n";
$httpReq .= "$xmlrpcReq\r\n";
if ($pinghandle = fsockopen($host, 80)) {
fputs($pinghandle, $httpReq);
while (!feof($pinghandle)) {
$pingresponse = fgets($pinghandle, 128);
}
fclose($pinghandle);
}
Thanks a lot!