[PHP] Getting web pages + contents

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by supajason, Jun 3, 2008.

  1. supajason

    supajason Member

    Messages:
    288
    Likes Received:
    2
    Trophy Points:
    18
    Hello All!

    I'm in need of some help, I have been trying to work this out forever and still no luck so i ask you please please help me!

    Scenario:
    Im trying to make and external login for a website.

    "login.php" has 3 fields (username, password and image) i want to get that page and let it set cookies save the image so i can type the captcha in then post the same page "login.php?username=xxxxx&password=xxxxxx&image=1234" and then display the result.

    so far i have displayed the page using CURL setting cookies BUT im unable to save the image because CURL gets the page and sets cookies but when i get the image its using a different session. so the page displayed image is 1111 but when i save the image its 2222.

    I can't change the login.php or the image.php page.


    PHP:
    <?php
    $cookie_file_path 
    "aaaa.txt";

    $url "http://localhost/login.php";
    $agent "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1";
    $ch curl_init(); 
    curl_setopt($chCURLOPT_URL,$url);
    curl_setopt($chCURLOPT_USERAGENT$agent);
    curl_setopt($chCURLOPT_RETURNTRANSFER1); 
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
    curl_setopt($chCURLOPT_COOKIEFILE$cookie_file_path);
    curl_setopt($chCURLOPT_COOKIEJAR$cookie_file_path);
    $result curl_exec ($ch);
    curl_close ($ch);
    print 
    $result;    

    ?>

    <img src="image.php">
    this works but how do i save the image thats displayed and not get another one!

    please somebody help me!
    Edit:
    Dont need this anymore!
     
    Last edited: Jun 3, 2008
  2. jjpeacha

    jjpeacha New Member

    Messages:
    125
    Likes Received:
    0
    Trophy Points:
    0
    can you post your solution so others who want the same thing can find out?

    Cheers
     
  3. supajason

    supajason Member

    Messages:
    288
    Likes Received:
    2
    Trophy Points:
    18
    I wish! i never found out! just given up and starting a new project now!
     

Share This Page