SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member omega's Avatar
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Using curl to search google and logging into pages.

    I want to login on pages using curl, which doesn't seem to work for me
    For example I want to log into fileforum and display the page which loads right after you have logged in. I use this code:
    PHP Code:
    <?
    $url 
    'http://www.betanews.com/login.php3'
    $postfields 'username=Myusername&password=MyPwd';   

    $ch curl_init(); 

    curl_setopt($chCURLOPT_RETURNTRANSFER1); 

    curl_setopt($chCURLOPT_URL$url); 
    curl_setopt($chCURLOPT_POST1);                
    curl_setopt($chCURLOPT_POSTFIELDS$postfields);  
    curl_setopt($chCURLOPT_RETURNTRANSFER,1);    

    $return curl_exec($ch); 

    curl_close($ch);  

    echo 
    $return

    ?>
    edit: Removed the google issue.
    Last edited by omega; Oct 9, 2003 at 16:37.
    If you can't get rid of the skeleton in your closet, you'd best
    teach it to dance.

  2. #2
    SitePoint Member
    Join Date
    Oct 2003
    Location
    Greece
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    http://www.google.com/apis/
    (+): easy to build in 30 minutes.
    (-): its good for 1000 queries per day.

  3. #3
    SitePoint Addict RapidGaming's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krysalis
    http://www.google.com/apis/
    (+): easy to build in 30 minutes.
    (-): its good for 1000 queries per day.
    That is very intresting, could we do it with PHP then?

  4. #4
    SitePoint Member omega's Avatar
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The thing with all this was just to get the post thing to work with curl/php, In the beginning I thought to do a php script that logs on to http://www.betanews.com/login.php3 and displays the page which come up right after. However I didn't managed to get it working, so I thought it would be best to learn the basic stuff first, why I started to get this google search to work.

    So what I want is just a _working_ test example of php code which uses CURL to login to a page, and displaying that page.
    Thanks.
    If you can't get rid of the skeleton in your closet, you'd best
    teach it to dance.

  5. #5
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's a tutorial somewhere on the web that shows exactly how to use the google API to search Google within PHP.

    I adapted it for a site a little while back. I'll see if I can find the link and/or post some of my own code.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

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