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

Re: [MacPerl-WebCGI] User Agent receives no response ?



At 11:20 +0100 08/02/1999, Julian Madle wrote:
Does anybody know why this does not work, or have any suggestions of how make it work ?



require LWP::UserAgent;
require HTTP::Request;


$url = "<http://194.242.130.251:80/">http://194.242.130.251:80/";
$ua = new LWP::UserAgent;


$request = new HTTP::Request 'GET', $url;
$response = $ua->request($request);


if ($response ->is_success) {$gotit = $response->content();print "Content-Type: text/html\n\n$gotit"}
else {print "Content-Type: text/html\n\nThis script has malfunctioned!"};



I have tried the URL as an IP and as localhost, both with and without the port number, but it made no
difference. Any help or suggestions will be much appreciated - Julian.

When I copied & pasted this code from Eudora Pro into BBEdit, the $url declaration showed up as:

$url = "<http://194.242.130.251:80/">http://194.242.130.251:80/";

which is pretty weird. Anyway, if I change this to point at my site:

$url = "http://www.richardgordon.net";

and just run it in BBEdit using the MacPerl plugin stuff, it works fine and returns the expected results. I'd suggest bypassing Web Sharing and using a url somewhere out on the internet that you know should work like www.cnn.com or whatever. If things seem to go okay, then you will know that either you got the url you were using wrong or it's just a problem with Mac Web Sharing that, in my opinion, is not worth trying to figure out.


Richard Gordon
--------------------
Gordon Consulting & Design
Database Design/Scripting Languages
mailto:richard@richardgordon.net
http://www.richardgordon.net
770.971.6887 (voice)
770.216.1829 (fax)