function sendPayloadHTTP10($msg, $server, $port, $timeout = 0, $username = "", $password = "")
{
if ($port == 0) {
$port = 80;
}
if ($timeout > 0) {
$fp = fsockopen($server, $port, $this->errno, $this->errstr, $timeout);
} else {
$fp = fsockopen($server, $port, $this->errno, $this->errstr);
}
if (!$fp) {
return 0;
}
// Only create the payload if it was not created previously
if (empty($msg->payload)) {
$msg->createPayload();
}
// thanks to Grant Rauscher <[email protected]>
// for this
$credentials = "";
if ($username != "") {
$credentials = "Authorization: Basic " . base64_encode($username . ":" . $password) . "\r\n";
}
$op = "POST " . $this->path . " HTTP/1.0\r\nUser-Agent: PHP XMLRPC 1.0\r\n" . "Host: " . $this->server . "\r\n" . $credentials . "Content-Type: text/xml\r\nContent-Length: " . strlen($msg->payload) . "\r\n\r\n" . $msg->payload;
if (!fputs($fp, $op, strlen($op))) {
$this->errstr = "Write error";
return 0;
}
$resp = $msg->parseResponseFile($fp);
fclose($fp);
return $resp;
}