Gossamer Forum
Quote Reply
GT::Socket
Is there a problem with the 'open' side of this? For some reason, this code is ALWAYS returning 404! (i.e the 'defined' section thinks the URL is not defined...so it skips);

Code:
my $id = $IN->param('ID'); # get ID of the link..so we can call SQL stuff..

# get rid of the http:// in the $url variable
$url =~ s,http://,,;

print $IN->header();
print $url . "<BR>";

# now connect to the URL..to see what we get...
my $sock = GT::Socket->open({
'host' => $url,
'port' => 80,
'timeout' => 20,
'max_down'=> 15
});

if (defined $sock) {

$sock->write( "GET / HTTP/1.0\n\n" );

$returned = $sock->gulpread(-1);

@sliced = split(/\s/, $returned);
$code_returned = $sliced[1];

} else {

print $IN->header(); print "returned a 404 cos nothing was defined <BR>";
$code_returned = "404";

}

That prints out, for example;

www.viewislam.com/belief/
returned a 404 cos nothing was defined


I've tried wrapping $url in quotes...i.e "$url,and adding http:// to the front of it..but nothing works! I even tried extending the length of time before a timeout!

PLEASE someone help! This is doing my head in! Frown

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] GT::Socket In reply to
You need to remove /belief/
Quote Reply
Re: [Paul] GT::Socket In reply to
Oh..but how would I verify that the actual sub page exists?

Thanks Smile

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] GT::Socket In reply to
Notice the GET line...

>>

$sock->write( "GET / HTTP/1.0\n\n" );

<<

Specifically GET / ....you are fetching the index page from / ...just change it to /belief/

Last edited by:

Paul: Jun 29, 2002, 6:15 AM
Quote Reply
Re: [Paul] GT::Socket In reply to
Thanks...thats great. I'm just getting too lazy...LOL. In PHP you can do;

$var = open("http://www.site.com/page/stuff.html");

and it will put it into the array for you Tongue

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] GT::Socket In reply to
>>
In PHP you can do;

$var = open("http://www.site.com/page/stuff.html");

and it will put it into the array for you
<<

...and in perl...

my @page = get($url);

...with LWP::Simple Sly
Quote Reply
Re: [Paul] GT::Socket In reply to
NWO he tells me! Tongue

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] GT::Socket In reply to
Or:

my $page = GT::URI::HTTP->get(http://someurl/foo);

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] GT::Socket In reply to
Wouldn't you need ' ' around that URL :)