Jump to content

[SOLVED] PHP cUrl - Nothing happening.


liamthebof

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.