Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

perl url checker


ghost's Avatar
0 0

I was trying to make a url checker in perl and now im completely lost


$url = "http://www.hellboundhackers.org/challenges/real2/backups/backup_2004-09-$day_$hour00.sql";

$day = 1;
$hour = 1;

use LWP::Simple;
while(!$check)
 {
print $day, " ", $hour, "\n";
$hour = $hour + 1;
      if($hour == 24)
       {
      $day = $day + 1;
      $hour = 1;
       }
      if($day = 1||2||3||4||5||6||7||8||9)
       {
      $day = "$day";
       }
      if($hour = 1||2||3||4||5||6||7||8||9)
       {
      $hour = "$hour0";
       }
      if($day == 31)
       {
      print "YOU SCREWED UP, NOTHING WAS FOUND";
      exit;
       }
my $check = get $url;
 }
print "THE URL ", $url, " IS NOT EMPTY";```

The problem is that it wont increment the day or hour variables and it wont add them to the URL

ghost's Avatar
0 0

I fixed up the day and hour, but i still cant add them to the URL, someone help please


n3w7yp3's Avatar
Member
0 0

You have to use string concaticnation. Its done with the '.'. So, to add them into the URL, try:

"(insert URL here)" . $whatever . $whatever . ".php"

A mate of mine actually had code to solve this that was very similar to yours… I told him the same thing and it worked.

GL.


ghost's Avatar
0 0

but also, can perl read .sql files cause if not…..


ghost's Avatar
0 0

but also, can perl read .sql files cause if not…..


n3w7yp3's Avatar
Member
0 0

Your code is not reading *sql files, itrs merlely checking for their existance.

While I have never seen a *.sql files, I'm sure that its possible to parse it with Perl. Even if its not ASCII, just chuck Perl into binmode and have it parse it then.