Hey all,
I am using the following code to connect to an https:// EPP server and send a preformatted XML file. My problems start when I try to receive the response xml file...
When I try to output the response to my browser, I get all squares (unrecognized characters), even if the page encoding is set to UTF-8, as the EPP server requires. Any idea on that?
Any help would be more than appreciated.
My code goes something like this:
$host = 'some.host.com';
$port = '700';
$fp = fsockopen ($host, $port, $errno, $errstr, 30);
if(!$fp) {
echo "Not Connected!";
}
else {
echo "Connected!";
$xml = '<yadda><some><xml /></some></yadda>';
fwrite($fp, "POST /path/to/proxy HTTP/1.0\r\n");
fwrite($fp, "Host: $host\r\n");
fwrite($fp, "Accept-Encoding: \r\n");
fwrite($fp, "Content-Type: text/xml;charset=UTF-8\r\n");
fwrite($fp, "Content-Length: ".strlen($xml)."\r\n");
fwrite($fp, "Connection: close\r\n");
fwrite($fp, "$xml\r\n");
fwrite($fp, "\r\n");
$response = "";
while (!feof($fp))
$response .= fgets($fp, 128);
echo $response;
fclose($fp);
Please note that I cannot use curl or XML-RPC since my hosting server does not support it.