Jump to content

roel018

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

roel018's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well, i could if I used an Apache server, but I'm using Windows Server 2003 Here's the code: <?php header('Content-type: multipart/x-mixed-replace;boundary=endofsection'); print "\n--endofsection\n"; $pmt = array("-", "\\", "|", "/" ); for( $i = 0; $i <10; $i ++ ){ sleep(1); print "Content-type: text/plain\n\n"; print "Part $i\t".$pmt[$i % 4]; print "--endofsection\n"; ob_flush(); flush(); } print "Content-type: text/plain\n\n"; print "The end\n"; print "--endofsection--\n"; ?>
  2. Hi all, I have written a script that get's a CGI video stream from my webcam's build-in server (streaming MJPEG content). The script just reads the incoming streaming data and outputs it into an HTML IMG tag. This works great on one server (my developer's server). However, on my online, shared hosting server (where it is supposed to run), it doesn't work - probably due to the fact that the failing server is buffering the incoming data (since phpinfo() tells me output_buffering is set to 4096 - and on the server where it does work on it is set to 0, well, actually it just says 'No value') .. In fact, it does spit put something (a whole lot of images in a fraction of a second) after it has downloaded the 4 mb of data, but then it starts buffering again.. So what do I do? Do I just mail my shared hosting provider and to set the output_buffering (local or master values? - I don't know the difference) to 0/NoValue ?? Or are there any other things I'm missing here to get this to work? One important other difference between the servers is that the server where it works on runs php version 5 and mine runs version 4.4.8 - Could this pose a problem as well??? (I can activate PHP 5 by request). phpiknfo() results from WORKING server: http://www.emotiontracker.com/test1-results-derek.htm phpiknfo() results from FAILING server: http://www.emotiontracker.com/test1-results-roel.htm Hope to get some insights into how to approach this problem P.s. it concerns a Windows Server so setting .htaccess is not an option. Thanks in advance! Roel.
  3. Hi all, I'm trying to connect to my webcam's cgi file which broadcasts a MJPEG stream. I'm trying to read it using PHP and send it to the browser (in an IMG tag, or any other usuable container). This is some info about CGI file I'm talking about: http://www.canvision.net/support/pt300-cgi/GetData.htm I found this code below which is used to access an IP camera and read the MJPEG stream, however it assumes that you target an IP address directly, but I'm using a source in the form of "http://mywebcamserver.com/GetData.cgi?Status=false" .. Which actually works when I type this in my browser's address bar - it produces a nice JPG stream.. But no luck so far with PHP. One pitfall: I have to bypass Basic Authentication protection since the cgi file is protected this way (I have the login details). I've been searching for a solution for days now. I discussed this issue with member Khaine in this thread, but we got stuck in the end. http://www.phpbuilder.com/board/show...php?t=10367689 Who can help me???? THANKS! <? // Set time limit to indefinite execution set_time_limit(0); // create TCP socket $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // connect to the camera's native stream protocol IP:Port socket_connect($sock,"10.0.0.20", 65310); // handshake with the camera socket_write($sock,"START\r\n"); // ignore the handshake response socket_read($sock, 12000); // daemonize this script while (true) { // simulate 4 escape sequences "\0A" with "\r\n" - or chr(0) socket_write($sock,"\r\n\r\n\r\n\r\n"); // read the image from the stream (max 80k) print socket_read($sock, 80000); // limit to ~6 frames per second usleep(166666); } ?>
  4. Yeah but how do I grab the most recent JPG from the cam and output it into the IMG tag? Because all I'm getting back are error messages that GetData.cgi is no valid JPG image....
  5. Hi everybody! I'm struggling with a serious issue for days now. I have a so called PHP proxy file which I'm using to bypass javascript's Same-Domain policy. This way, I'm reading the status of my public webcam (online or offline). I'm calling a file integrated in this (very advanced, build-in webserver enabled) webcam of mine to accomplish this, and it works great, without any flaws (I even manage to bypass the Basic Authentication protection this way). Anyway, you'll find my code below. The problem I'm facing, is that I would like to catch the webcam's image stream using the exact same method. The webcam's image stream, which is in fact a series of JPG's (mJPG), broadcasted by a file called GetData.cgi using the "multipart/x-mixed-replace" mime-type. When I type "http://192.x.x.4/GetData.cgi?1234" into my browser's address bar, after providing the webcam's username and password, I instantly get the JPG stream. So it's really there.. When I check the page's properties in my browser, it says it's an image/jpeg document. Now, I would really like to know HOW I could get that stream of JPG's, and echo them onto the screen. That's all I want. Because I would like to create an <IMG> tag in my page, have the SRC pointed to this PHP proxy file, and have the image returned. All attempts so far have ended in PHP throwing errors at me that the provided data is NO valid image data... Bummer. Hope someone can help me out here. I'm posting the GetData.cgi contents as well just below my proxy file's code. Thanks, Kind regards, Roel I use the code below (proxy_get_binary.php) to get the images and to access other files on the cam's build-in webserver (the later works perfectly). I'm calling this script with the following javascript command: return ('<img id="oCamCtl" src="proxy_get_binary.php?remotefile=/GetData.cgi&status=true' + '&keycode=3748845" width="' + width + 'px" height="' + height + 'px" />'); <?php error_reporting(-1); $masteruser = 'myloginname'; $masterpass = 'mypassword'; $status= ($_POST['status']); $keycode = ($_POST['keycode']); $remotefile = ($_POST['remotefile']); $remoteserver = '192.xxx.xxx.104'; $urlstring = '?status='.$status; $url = 'http://'.$remoteserver.$remotefile.$urlstring; $url = parse_url($url); $port = 80; //just some checks to see if user is allowed to access this page: if($keycode == '3748845') { $host = $url['host']; } else { $host = "127.0.0.1"; } $fh = fsockopen( $host, $port ); if( $fh ) { fwrite( $fh, "GET ".$url['path'].$urlstring." HTTP/1.0\r\n" ); // in case we deal with virtual hosts pass the domain we are interested in. fwrite( $fh, "Host: ".$url['host']."\r\n" ); // rfc2617: basic authorization header plus base64 encoded username:password fwrite( $fh, "Authorization: Basic ".base64_encode( $masteruser.":".$masterpass )."\r\n" ); // end of the request header fwrite( $fh, "\r\n" ); // practically ignore all answering headers send by the server while( ! feof( $fh ) && ($debug = fgets( $fh )) != "\r\n" ) /*echo $debug*/; // display only the body of the message while( ! feof( $fh ) ) { echo fgets( $fh ); } fclose( $fh ); } ?> Here's some info (from the manufacturer) about the cgi script that gives me headaches: GetData.cgi is designed for "server-push". "Server-push" means that user need not always detect camera's state, and the camera server transfer the camera data on its own. GetData.cgi[?Status=false] returns: HTTP/1.0 200 OK Date: Wed, 19 Feb 2003 03:40:16 GMT Server: WYM/1.0 Connection: close Content-Type: multipart/x-mixed-replace;boundary=WINBONDBOUDARY Last-Modified: Wed, 19 Feb 2003 03:40:16 GMT Pragma: no-cache Cache-Control: no-cache Expires: 01 Jan 1970 00:00:00 GMT --WINBONDBOUDARY Content-Type: image/jpeg <content of jpeg file> --WINBONDBOUDARY Content-Type: image/jpeg <content of jpeg file> --WINBONDBOUDARY ... GetData.cgi?Status=true returns: HTTP/1.0 200 OK Date: Wed, 19 Feb 2003 03:40:16 GMT Server: WYM/1.0 Connection: close Content-Type: multipart/x-mixed-replace;boundary=WINBONDBOUDARY Last-Modified: Wed, 19 Feb 2003 03:40:16 GMT Pragma: no-cache Cache-Control: no-cache Expires: 01 Jan 1970 00:00:00 GMT --WINBONDBOUDARY Content-Type: image/jpeg <content of jpeg file> --WINBONDBOUDARY Content-Type: text/plain <same as what's returned by GetStatus.cgi> --WINBONDBOUDARY Content-Type: image/jpeg <content of jpeg file> --WINBONDBOUDARY Content-Type: text/plain <same as what's returned by GetStatus.cgi> --WINBONDBOUDARY ... THNX!!!!!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.