Mmmm.I have a really weird one here. For some reason, the variable alsways goes to 404.
# get rid of the http:// in the $url variable
$url =~ s,http://,,;
print $IN->header();
print $url;
# now connect to the URL..to see what we get...
my $sock = GT::Socket->open({
'host' => $url,
'port' => 80,
'timeout' => 5,
'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";
$code_returned = "404";
}
Anyone got any ideas? I've tried quoting "$url", bu that didn't make a difference [:9]
Thanks
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!
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;
# now connect to the URL..to see what we get...
my $sock = GT::Socket->open({
'host' => $url,
'port' => 80,
'timeout' => 5,
'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";
$code_returned = "404";
}
Anyone got any ideas? I've tried quoting "$url", bu that didn't make a difference [:9]
Thanks
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!