Ok... am I going mad here? Basically, the following routine *should* check to see the output of the website grabbed. In this case, it is an image grabbed from Links SQL, via jump.cgi. If the file doesn't exist, the page should contain 'Unknown' ... which the regex should pick up. For some reason though, it always returns 1! Can anyone see my boo-boo?
sub check_image_exists {
my $id = $_[1];
my $field = $_[0];
my $grabbed = get("http://www.site.com/cgi-bin/vehicles/jump.cgi?ID=$id&view=$field");
$grabbed =~ s/\n//g;
my $got = 1;
if ($grabbed =~ /Unknown/si) { $got = 0; }
$got ? return 1 : return 0;
}
Cheers
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:
# routine to see if image exists... sub check_image_exists {
my $id = $_[1];
my $field = $_[0];
my $grabbed = get("http://www.site.com/cgi-bin/vehicles/jump.cgi?ID=$id&view=$field");
$grabbed =~ s/\n//g;
my $got = 1;
if ($grabbed =~ /Unknown/si) { $got = 0; }
$got ? return 1 : return 0;
}
Cheers
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!