Hi there,
I'm using the following headers:
// Connection values
$cps_host = "blablabla.co.uk";
$cps_port = "80";
// Create the TCP/IP socket
$cps_sock = fsockopen($cps_host, $cps_port);
if(!$cps_sock) {
echo "Error: Could not connect to server.";
} else {
$cps_return = "";
// Send the submit variable
fputs($cps_sock, "POST /cps_calculator.asp HTTP/1.1\r\n");
fputs($cps_sock, "Host: host\r\n");
fputs($cps_sock, "Content-Type: application/x-www-form-urlencoded\r\n");
fputs($cps_sock, "Content-Length: ".strlen($this->dataString)."\r\n");
fputs($cps_sock, "Connection: close\r\n\r\n");
fputs($cps_sock, $this->dataString);
Unfortunately this doesn't work. :p I've tried it without the Host section, but it's refused, and with it, its refused.
I'm communicating with an IIS server here so I think I'm probably missing one or two headers that it may require and other servers don't.
Anyhow, I was getting:
Bad Request (Invalid Hostname)
After adding the header "Host: host" - I'm now getting this error:
You are not authorized to view this page
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.
Now, obviously IIS doesn't want to accept any input at all without a hostname (at least, that's how I see it) but it also won't let me in with a hostname saying I've got the wrong authorization. 😐
Any help will be appreciated! 🙂
Thanks,
Chris