Results 1 to 8 of 8

Thread: is this possible in perl?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2001
    Posts
    746

    is this possible in perl?

    can i retrieve the source for a website as a string? for instance could i have $google be the source for www.google.com/search?q=perl

    ??
    FlameWave Technologies - internet tools

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Yes, it is. How? I don't know. But I have seen scripts that download news from certain webpages to display it on theirs. So yes, it is possible.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    You can use the LWP::Simple module to do what you require!

    However google have blocked this kind of request on their
    'search' script (probbaly to stop people mirroring thier site).

    Code:
    #!/usr/bin/perl
    
    use LWP::Simple;
    
    $content = get("http://www.google.com/search?q=perl");
    
    print $content;
    Have a play about with the above script you'll find that if you use this on a server side script you will usually get whatever the script returns, not the actual script itself. But in the case of google thier script checks where the request is coming from and pumps out a forbidden page.

    You can't download the actual script itself. Otherwise malicious people could find ways to crack your server!

    For more info look up LWP::Simple on the search engines!!


  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2001
    Posts
    746
    what do u mean u cant download the script itself? i thought web servers dont let u download actual cgi scripts only the pages that they return right?
    FlameWave Technologies - internet tools

  5. #5
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Provided they are correctly configured, you are correct.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    how correctly configured?

  7. #7
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    *shrug* The server isn't supposed to give you the source for the CGI script.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  8. #8
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    what do u mean u cant download the script itself? i thought web servers dont let u download actual cgi scripts only the pages that they return right?
    Exactly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width