Re: Image from a secure site

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well  in case someone need to do this... this is the code.. very easy at all..

header ('Content-type: image/jpeg');
$ch =curl_init("http://contelec.sytes.net:2002/IMAGE.JPG?cidx=20072261649239281";);
curl_setopt($ch,CURLOPT_USERPWD,"invitado:invitado");
curl_exec($ch);
curl_close($ch);
	

2007/3/13, Manolet Gmail <manolet@xxxxxxxxx>:
2007/3/12, Richard Lynch <ceo@xxxxxxxxx>:
>
> Instead of trying to re-invent the authentication wheel, just use
> http://php.net/curl
>

wow!! Thanks you A LOOOOOOOOOOOT!!! thats amazing!!!



>
> On Thu, March 8, 2007 4:51 pm, Manolet Gmail wrote:
> > hi, i install 4 IP cameras and i want to extract the images from their
> > web interface that is protected be a username and password (HTTP AUTH)
> > and show it into another system. so i do a function to connect to it
> > and get the image...
> >
> > function subd($host,$port,$ownername,$passw,$request) {
> >   $sock = fsockopen($host,$port);
> >   if(!$sock) {
> >     print('Socket error');
> >     exit();
> >   }
> >
> >   $authstr = "$ownername:$passw";
> >   $pass = base64_encode($authstr);
> >   $in = "GET $request\r\n";
> >   $in .= "HTTP/1.0\r\n";
> >   $in .= "Host:$host\r\n";
> >   $in .= "Authorization: Basic $pass\r\n";
> >   $in .= "\r\n";
> >
> >   fputs($sock, $in);
> >   while (!feof($sock)) {
> >       $result .= fgets ($sock,128);
> >   }
> >   fclose( $sock );
> >
> >   return $result;
> > }
> >
> >
> > and next i want to print it into the browser..
> >
> >
> > $request = "/IMAGE.JPG?cidx=20072261649239281";
> > $result =
> > subd('contelec.sytes.net',2002,"invitado","invitado",$request);
> > header ('Content-type: image/jpeg');
> > imagejpeg($result);
> > exit();
> >
> > but doesnt work.... if you want to check the cam you can go to
> > http://contelec.sytes.net:2002 the username is invitado and the
> > password is invitado.
> >
> > please help me!
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux