[ELECTRON] PHP - question. . . webcam script...again(ish)

Ben Rush orionrush at gmail.com
Tue Apr 20 21:28:22 UTC 2010


Hey folks,

Just an update on the project that I was working on.

www.astonesthrowaway.co.uk is live, check it out. The beacon is having some
servicing at the moment so isn't active but the question I need help on is
in the PHP webcam script that I was working on a month ago.

the updated code can be found here: http://pastebin.com/xsd9tKU6

To my alarm I was looking at the site from a web kiosk at the BBC and the
home page was throwing a 404. Now I realise this might be a simple case of
the site not being on their allowed list, but oddly I could still get still
to the backend and preview the site through an Iframe just fine from the
same computer. Could my script be causing this error? The script generates
the image for the background of the page so I directed the browser to the
script itself and the browser balked, citing an illegal execution - I assume
this to be the echo on line 38, which dumps the jpg data to the browser
(with appropriate headers).

Will a few folks running windows take a look at this for me? I've previewed
this in IE6,7,8 in an emulator and didn't run into this behaviour. Whats
alarming is that the site is totally inaccessible to anyone working under
these restrictions - very bad news.

Anybody have any bright ideas?

Many thanks,
Ben Rush




On 4 April 2010 14:41, Ben Rush <orionrush at gmail.com> wrote:

> Holly cow - IT LIVES!
>
> I had no idea - I just thought I'd keep the error reporting to see what
> went wrong. Didn't clock that it this in itself would generate headers, but
> it makes total sense. Thanks so much Mark & Gordon for looking at this -
> beer's on me when we meet.
>
> Cheers all for the air-time, - Merry Easter!
> Ben R.
>
> On 4 April 2010 00:45, Mark Bryars <electronclub at darkskiez.co.uk> wrote:
>
>> You probably don't have errors suppressed, and the fopen to test if the
>> camera is there is failing and printing an error, which generates
>> output, which means you cant send any headers.
>>
>> prefix the fopen with an @ sign
>>
>> if (@fopen($img_remote, "r")== true )
>>
>>
>> Regards,
>>  Mark
>>
>> Ben Rush wrote:
>> > Gordon,
>> >
>> > Thanks for taking a look at this - I got the sense that an something
>> > was firing off before it should. I've yet to break away from family
>> > obligations this weekend, but I have managed to post the code to paste
>> > bin: http://pastebin.com/rrC86Zdj
>> >
>> > happy Easter everyone - cracking day out today, spent it fishing for
>> > sculpture bits out of the graving docs in Govan -- good times!
>> >
>> > Ben
>> >
>> >
>> > On 3 April 2010 20:43, Gordon JC Pearce <gordonjcp at gjcp.net> wrote:
>> >
>> >> On Sat, 2010-04-03 at 00:15 +0100, Ben Rush wrote:
>> >>
>> >>> Hello folks,
>> >>> Im going to preface this by stating I'm a self described noob, so if
>> >>> this seems elementary - I stand by my assertion.
>> >>> I have come to a block and Im not sure how to deal with it, and any
>> >>> thought would be amazing.
>> >>>
>> >>> Im working on a fetch image script for a webcam and everything seemed
>> >>> hunky-dorry.
>> >>>
>> >>> I later decided to add an if/else on the off chance the camera wasn't
>> >>> available. This is where things got confusing.
>> >>>
>> >>> If the camera fails I get a "Warning: Cannot modify header
>> >>> information". The thing is I cant figure out were the header info is
>> >>> being declared, as the warning seem to indicate that the declaration
>> >>> comes from in the 'if' statement itself. Wait didn't that just fail?!?
>> >>>
>> >> Something is outputting stuff to the server before you get a chance to
>> >> send the header() part.
>> >>
>> >> A quick demonstration - type "telnet www.electronclub.org 80"
>> >> Once you get the "Escape character is '^]'." message type
>> >> "GET / HTTP/1.0" then <RETURN> <RETURN>
>> >>
>> >> You'll see the server's response - "HTTP/1.1 200 OK" and a bunch of
>> >> things like "Date:" and "Length:" and importantly "Content-Type:".
>> >> These are the headers.  There's a blank line before the actual content
>> >> *and this is very important*.
>> >> Once you send that blank line, you cannot send any more headers.
>> >>
>> >>
>> >>> Moving the 'header('content-type: image/jpg');' higher up in the
>> >>> script doesn't seem to fix it. Moving it before the if statement all
>> >>> together gives a broken image link - the echo of file contents don't
>> >>> seem to make to the browser.
>> >>>
>> >>> I also checked to see if there was any empty space before or after my
>> >>> <? ?> - no empty echoes there either. .
>> >>>
>> >> Can you put the script up in something like pastebin, with line
>> numbers?
>> >> That would make it a wee bit easier to trace.
>> >>
>> >> Gordon MM0YEQ
>> >>
>> >>
>> >> _______________________________________________
>> >> members mailing list
>> >> members at electronclub.org
>> >> http://lists.electronclub.org/cgi-bin/mailman/listinfo/members
>> >>
>> >> Instructions for changing your mailing list settings:
>> >> http://lists.electronclub.org/emailhowto.html
>> >>
>> >>
>> >
>> > _______________________________________________
>> > members mailing list
>> > members at electronclub.org
>> > http://lists.electronclub.org/cgi-bin/mailman/listinfo/members
>> >
>> > Instructions for changing your mailing list settings:
>> > http://lists.electronclub.org/emailhowto.html
>> >
>>
>>
>> _______________________________________________
>> members mailing list
>> members at electronclub.org
>> http://lists.electronclub.org/cgi-bin/mailman/listinfo/members
>>
>> Instructions for changing your mailing list settings:
>> http://lists.electronclub.org/emailhowto.html
>>
>


-- 
orionrush at gmail.com
M +44 7964 565 153
make-us-believe.blogspot.com
www.flickr.com/orionrush
www.gsamfa.com/2009/benjamin_rush.php
www.linkedin.com/in/orionrush
central station http://tiny.cc/orionrush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.electronclub.org/pipermail/members/attachments/20100420/2da12d19/attachment.htm>


More information about the members mailing list