Results 1 to 3 of 3

Thread: Querying Webpage PL/PHP

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    North Carolina
    Posts
    734

    Querying Webpage PL/PHP

    Say I wanted to do something like the Inet control does in VB6:

    Inet1.OpenURL(url as string)

    How would one accomplish this in either Perl or PHP? Would you have to open your own connection to the URL and get what is returned?


    "X-mas is 24.Desember you English morons.." - NoteMe

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Querying Webpage PL/PHP

    With PHP, you can supply a http URL in pretty much any place where a file name is wanted, e.g. in fopen(), file_get_contents(), ...

    file_get_contents() is the easiest of those, but it needs PHP 4.3 or later.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    North Carolina
    Posts
    734

    Re: Querying Webpage PL/PHP

    Alright, while I didn't use PHP this time that will be helpful for the future! What I did was use perl and the following:

    PHP Code:
    use LWP::UserAgent;

    my $ua LWP::UserAgent->new;
    my $QUERY_URL "http://google.com/movies?sc=1&near=27502&rl=1&tid=ae5bb734333a162c";

    my $req HTTP::Request->new(GET => $QUERY_URL);
    $req->header(Accept => 'text/html');

    my $res $ua->request($req);
    my $content $res->content
    But thanks for your suggestion!


    "X-mas is 24.Desember you English morons.." - NoteMe

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