khaine;10925434 wrote:Curl could be the answer. It is basically a pretend browser that you can get data with.
http://uk2.php.net/manual/en/book.curl.php
Basically.
<?php
// create curl resource
$ch = curl_init('http://192.x.x.4/GetData.cgi');
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, '?1234&status='.$status);
curl_setopt($ch, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_USERPWD, $masteruser.':'.$masterpass);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
?>
Would be something like it. Then the $output string will contain the raw output. You should be able to send the image/jpg header and then just echo it to screen.
Hey thnx for that tip!
Well, when I use your code to call the GetData.cgi script, the script keeps on running (at least the page keeps on loading) however nothing appears on screen, even more so, the page isn't loaded into the browser at all.
When I call the /Jpeg/CamImg1234.jpg file on the cam's server (which normaly, when used in an img tag, gives me the last JPG image the cam produced), I strangely enough get the following error:
404 Not Found
The requested URL /Jpeg/CamImg1234.jpg was not found on this server.
Weird, because, it DOES exist.. (well not on my shared hosting web server, but on the cam's server I'm pointing to.
This is the script I'm using:
<?php
// create curl resource
//$ch = curl_init('http://194.x.x.104/GetData.cgi');
$ch = curl_init('http://194.x.x.104/Jpeg/CamImg1234.jpg');
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'myloginname:mypassword');
// $output contains the output string
$output = curl_exec($ch);
echo $output;
// close curl resource to free up system resources
curl_close($ch);
?>
Btw, :
$output = curl_exec($ch);
header('Content-type: image/jpeg');
imagejpeg($im);
Doesnt work either... I'll get nothing but the URL of the page I'm in at that time printed on screen.