Help! How to make http request from perl CGI? 
Author Message
 Help! How to make http request from perl CGI?

Quote:


>> I'd like to know how to write a perl CGI script that would make an
>> http request for an html document, do some stuff to the document, and
>> then push the results to the browser.

>>   Writing a CGI doesn't trip me at all--but making the http
>> request--that's the trick. If anyone can help me, I'd greatly
>> appreciate
>> the knowledge.

>>   Thanks in advance!

>> - mike

>You can take a look at the very good book CGI Programming witten by
>Shishir Gundavaram at O'Reilley & Associates, Inc.
>require "sockets.pl";

danger will robinson!

that stuff is dated and there are new and improved ways to do that,
like using the LWP module [1], with techniques from the Pelican book [2].  

[1] at a Comprehensive Perl Archive Network
find one near you at <URL: http://www.*-*-*.com/ >

[2]
Web Client Programming with Perl
Clinton Wong
ISBN 1-56592-214-X
<URL: http://www.*-*-*.com/ >

--



Fri, 25 Feb 2000 03:00:00 GMT  
 Help! How to make http request from perl CGI?

Quote:

> I'd like to know how to write a perl CGI script that would make an
> http request for an html document, do some stuff to the document, and
> then push the results to the browser.

>   Writing a CGI doesn't trip me at all--but making the http
> request--that's the trick. If anyone can help me, I'd greatly
> appreciate
> the knowledge.

>   Thanks in advance!

> - mike

You can take a look at the very good book CGI Programming witten by
Shishir Gundavaram at O'Reilley & Associates, Inc.
(http://www.oreilly.com), US$ 29.95. There is a chapter dedicated to
checking heyptertext links. You can get the perl script sockets.pl,
written for socket connections and others at
ftp://ftp.ora.com/published/oreilly/nutshell/cgi . In your script you
have to add:

require "sockets.pl";

and something like

&open_connection (HTTP, $server, http);

HTTP is now a filehandle open for writing and reading. Now you have to
say something like this to the server:

print HTTP "GET /index.html HTTP/1.0\n\n";

and read the output through the <HTTP> filedhandle.

Hope this helps

Patrick



Fri, 25 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Making http requests with extra headers

2. Making http request, with GET method?

3. Making http requests with extra headers

4. HELP: Perl Internet (HTTP->Request())

5. HTTP::Request -- Using POST to cgi forms

6. HTTP Request by CGI Program

7. HTTP::Request not requesting

8. HTTP::Request::Common and HTTP::Cookies

9. LWP HTTP::Request and HTTP::Cookies

10. Help: accessing text of raw http request

11. Help w/ HTTP::Request

12. need help with http get request

 

 
Powered by phpBB® Forum Software