cUrl
Moderator: General Moderators
cUrl
Hi,
I have the following question, have been busy googling and searching around but couldnt find what i need.
iniate cUrl
post fields and login -- works fine untill here.
-------- kinda confused on how to do the following.
Now the using same curl session to open another url inside the protected site.
and post other fields
logout .
I have the following question, have been busy googling and searching around but couldnt find what i need.
iniate cUrl
post fields and login -- works fine untill here.
-------- kinda confused on how to do the following.
Now the using same curl session to open another url inside the protected site.
and post other fields
logout .
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Ok let me see if i can explain better
first page, has user and password -- this is no problem i pass have the curl follow redirect
Now i am in the main page after i logged in.
Now how do switch location once being here ?
menu has - link 1 , link 2 , link 3
I want to go to link 2, and from here use curl again to submit some data and logout !
first page, has user and password -- this is no problem i pass have the curl follow redirect
Now i am in the main page after i logged in.
Now how do switch location once being here ?
menu has - link 1 , link 2 , link 3
I want to go to link 2, and from here use curl again to submit some data and logout !
Ok, tried several options and cant figure this one out.
Am i missing something ?
Code: Select all
$url = "full_url_login.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "user:pass");
$url = "url2_afterlogin.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
echo $result; // echos 1, i am not sure if i am in second url. with fopen(sometext.txt) the file turns up empty- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: