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);
# 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!
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
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!
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

