1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP and Perl

Discussion in 'PHP' started by Cep, Jul 20, 2005.

  1. #1
    Hi, i have search a lot and cant find an answer, i want that perl execute a php file, i have tried with this but doesnt works:

    #$FilePath = "http://localhost/~sparkiiflor/test/write.php?men=hola";
    #$file = "http://localhost/~sparkiiflor/test/write.php";
    open(INFO, $file) or die "Error\n";
    @lines = <INFO>;y
    close(INFO);
    print @lines;

    and with this
    system("write.php");

    But doesnt works, any idea???
     
    Cep, Jul 20, 2005 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    blind leading the blind here but this has worked for me in the past
    #!/usr/local/bin/perl -w
    
    use LWP::Simple;
    use CGI;
    
    my $URL="http://mysite.net/process_cache.php";
    
    my $content = LWP::Simple::get($URL);
    
    print "$content";
    Code (markup):
     
    sarahk, Jul 21, 2005 IP
  3. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Yes that should work, but you don't need the use CGI; statement. You never call any methods from the package, so its not necessary.
     
    UndiesHosting, Jul 26, 2005 IP
    sarahk likes this.
  4. Discreet

    Discreet Guest

    Messages:
    550
    Likes Received:
    92
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If that doesn't work, this will:

    use WWW::Mechanize;

    my $mech = Mechanize->new();
    my $url = "http://www.yahoo.com";
    $mech->get($url);
    my $content = $mech->content();

    I use Mechanize over LWP because it has some other cool functions (it can submit forms, does wonders for testing checkouts lol).
     
    Discreet, Jul 28, 2005 IP
    sarahk likes this.