Jump to content

Recommended Posts

Hello, yet again.

 

I am making another php script which requires a login to get the page a data I require. I have used cUrl before, but I still do not know very much. I used Live headers to get the required postfields but still no luck.

 

$url = "http://xxxxxxx.net/index.php?action=login";
$post = "user=xxxx&passwrd=xxxx&cookieneverexp=on";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');

//curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

echo $output;

 

The output is the login page with nothing changed. Not logged in, no 'incorrect password'. Ect.

 

Any ideas. No doubt there is a very easy solution.

 

Another note, it is a SMF forum, if that makes a difference.

Link to comment
https://forums.phpfreaks.com/topic/163265-solved-php-curl-nothing-happening/
Share on other sites

Its stays on index.php.

 

On another note, I think this may be related.

 

This is an example of the cookie received when using liveheaders.

Cookie: PHPSESSID=5c8febe59114b15ee507b1e032958ec6; SMFCookie463=a%3A4%3A%7Bi%3A0%3Bs%3A2%3A%2243%22%3Bi%3A1%3Bs%3A40%3A%22b56f140351f568fd7894418dc6dab2b18fef755c%22%3Bi%3A2%3Bi%3A1434907814%3Bi%3A3%3Bi%3A1%3B%7D

 

Furthermore, my cookie.txt file is not being edited.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.