I'm trying to grab an image from a web server using
Code: Select all
img src="http://10.50.200.23/CGI/Screenshot"is there any way to send the authentication within the request?
I was initially trying to do this using something like this:
Code: Select all
$screenshotreq ="POST CGI/Screenshot HTTP/1.0\r\n";
$screenshotreq.="Host: 10.50.200.23\r\n";
$screenshotreq.="Authorization: Basic 10014535:4535\r\n";
$screenshotreq.="Connection: close\r\n";
$screenshotreq.="Content-Type: application/x-www-form-urlencoded\r\n";
$response = "";
$sock = fsockopen($ip, 80, $errno, $errstr, 30);
if ($sock) {
fwrite($sock, $post . $xml);
while (!feof($sock)) {
$response .= fgets($sock, 128);
}
fclose($sock);
}
}Any help grandly appreciated (i'm a n00b when it comes to PHP and am really struggling!)
Dan