unb has asked for the wisdom of the Perl Monks concerning the following question:
Can you please tell me how should I properly display the responce from a get request to a browser.sub mobileDevice(){ use IO::Socket; my $sock = new IO::Socket::INET ( PeerAddr => '192.168.1.1', PeerPort => '3024', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; print $sock "GET http://192.168.2.1:8080/campus_tour/Demo/photo_01.jpg + HTTP/1.0\n"; print $sock "Content-Length: 0\n"; print $sock "Host: 192.168.2.1\n"; print $sock "User-Agent: EricssonT200\r\n\r\n"; $chk = 0; while ( ($response = <$sock>) && $chk==0 ){ if ( $response =~ /Connection: close/ ){ $chk = 1; } } while ( $response = <$sock> ){ print "$response\n"; } close($sock); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to display the response from a get request to a browser?
by davorg (Chancellor) on Oct 27, 2004 at 15:02 UTC | |
|
Re: How to display the response from a get request to a browser?
by Joost (Canon) on Oct 27, 2004 at 15:10 UTC | |
by unb (Initiate) on Oct 27, 2004 at 15:52 UTC | |
by Joost (Canon) on Oct 27, 2004 at 15:56 UTC | |
by unb (Initiate) on Oct 27, 2004 at 17:57 UTC | |
|
Re: How to display the response from a get request to a browser?
by elwarren (Priest) on Oct 27, 2004 at 16:04 UTC | |
by elwarren (Priest) on Oct 27, 2004 at 16:12 UTC | |
by unb (Initiate) on Oct 27, 2004 at 17:16 UTC |