hello,
i'm a newby and not very good at cgi/perl and i'v been trying for 2 day's now to get this script i found on the internet to work

this is the page of the scripts article: http://www.devarticles.com/index.php?option=content&task=view&id=622

I only need the part where it get's the info files form the servers and then updates the database to work!
which is this part but cant get it to work:
#!/usr/bin/perl my ($ip_date, $file_time, $file, $apnic, $ripe, $arin, $lacnic, @regis +tries, $url, $curl); $ip_date = (strftime("%Y%m", localtime(time)))."01"; $file_time = (strftime("%Y%m%d-%H%M", localtime(time))); $file = $file_time."_ip_data.txt"; $apnic = "ftp://ftp.apnic.net/pub/stats/apnic/apnic-latest"; $ripe = "ftp://ftp.apnic.net/pub/stats/ripe-ncc/_ripencc.latest"; $arin = "ftp://ftp.apnic.net/pub/stats/arin/arin.".$ip_date; $lacnic = "ftp://lacnic.net/pub/stats/lacnic/lacnic.".$ip_date; open (BODY,">>$file"); @registries=($apnic,$ripe,$arin,$lacnic); foreach $url(@registries) { # Init the curl session $curl= WWW::Curl::easy->new() or die "curl init failed!\n"; $curl->setopt(CURLOPT_URL, $url); $curl->setopt(CURLOPT_FTP_USE_EPSV, '0'); $curl->setopt(CURLOPT_FILE, *BODY); if ($curl->perform() != 0) { print "Failed ::".$curl->errbuf."\n"; } } close BODY; $dbh = DBI->connect("DBI:mysql:host=localhost;database="data_base","us +er","pass",{PrintError=>0,RaiseError=>1}); $sth = $dbh->do("DELETE from ip_map"); print "\n\nData from ip_map table dropped\n\n"; $sth = $dbh->prepare("INSERT into ip_map values (?,?,?,?)"); $count = 0; open (PROCESS, "<$file"); while ($line = <PROCESS>) { chomp ($line); if (($line =~ m/\|ipv4\|/) and ($line !~ m/\*/)) { ($registrar,$country_code,$item_type,$start_ip,$num_ip,$entry_date, $r +egistry_type) = split(/\|/, $line); @octets_start = split(/\./, $start_ip); $long_start = 0; foreach $octet_start (@octets_start) { $long_start <<= 8; $long_start |= $octet_start; } $long_end = $long_start + ($num_ip-1); $count += $sth->execute($country_code,$registrar,$long_start,$long_end +); } } close PROCESS;
if i upload this script as a .cgi or .pl with chmod 755 and then call it in the browser nothing happens, no error's either. am i missing a path to files or something? do need to call this form shell? curl is installed!

can some one please help me with this!!!!

thanx for your help

Janitored by holli - added code tags

Retitled by holli from 'PLEASE HELP'.


In reply to Problem retrieving data using WWW::Curl by gizmo2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.