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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread GT::Socket Andy 5331 Jun 29, 2002, 4:27 AM
Thread Re: [Andy] GT::Socket
Paul 5134 Jun 29, 2002, 4:40 AM
Thread Re: [Paul] GT::Socket
Andy 5163 Jun 29, 2002, 4:47 AM
Thread Re: [Andy] GT::Socket
Paul 5129 Jun 29, 2002, 6:14 AM
Thread Re: [Paul] GT::Socket
Andy 5195 Jun 29, 2002, 6:33 AM
Thread Re: [Andy] GT::Socket
Paul 5119 Jun 29, 2002, 6:36 AM
Thread Re: [Paul] GT::Socket
Andy 5172 Jun 29, 2002, 6:39 AM
Thread Re: [Andy] GT::Socket
Alex 5100 Jun 30, 2002, 10:53 PM
Post Re: [Alex] GT::Socket
Paul 5091 Jul 1, 2002, 2:22 AM