[PHP] Getting web pages + contents

supajason

Member
Messages
288
Reaction score
2
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($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_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:

jjpeacha

New Member
Messages
125
Reaction score
0
Points
0
can you post your solution so others who want the same thing can find out?

Cheers
 

supajason

Member
Messages
288
Reaction score
2
Points
18
I wish! i never found out! just given up and starting a new project now!
 
Top