cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

How do I get POST working? Please.

From: ErAzeR <erazer.se_at_telia.com>
Date: Wed, 22 Oct 2003 23:41:49 +0200

I want to login on pages using curl, which doesn't seem to work for me.
For example I tried to log into fileforum and display the page which loads right after you have logged in. I used this code:
<?
$url = 'http://www.betanews.com/login.php3';
$postfields = 'username=just_testing&password=just_testing'; //Login and password works for real, so you can try it out.

$ch = curl_init();

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$return = curl_exec($ch);

curl_close($ch);

echo $return;
?>

Actually I dont get the POST function to work on any page? What is missing?
It would be nice with a working example of php code which uses CURL to login to a page, and displaying that page.
Im using:
Php 4.3.1 with libcurl 7.10.2 & OpenSSL 0.9.7c (win xp)
Thanks.
Anders.

-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
Received on 2003-10-23