Thanks for this anonymous submission
Learn to use curl with php to query remote webservers for data. This can be done to automate form submission, process credit cards, and more. Topics covered include SSL, cookie handling, and more.
Read the full article here
October 11th, 2006 at 3:57 pm
yeah fully recomend this curl article you are linking to. i’ve just gone beyond the basics of php programming and been learning curl to help facilitate multi server transfers. unfortunately decent curl tutorials (written in basic english anyway!) are few and far between. this article gets straight to the point. good find phpkitchen
jezzen
February 10th, 2007 at 11:41 am
thanks it helps..:D
April 10th, 2007 at 3:45 pm
thanks!
June 29th, 2007 at 2:49 am
I am wondering how to do both a post and get request with curl
in the same session.
I need to post the user id and password to https:// url#1
and then get the XML data from https://url#2
I am able to perform the post successfully but get and invalid session
response on the get request.
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, ‘https:// url ‘);
curl_setopt($ch, CUPROPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CUPROPT_SSL_VERIFYHOST, FALSE);
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, ‘userid=fieldvalue1&password=fieldvalue2’);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// EXECUTE 1st REQUEST (LOGIN)
$postresponse = curl_exec ($ch);
echo $postresponse
// SET FILE TO DOWNLOAD
curl_setopt($ch, CURLOPT_URL, ‘https:// url#2 for xml data’);
// EXECUTE 2nd REQUEST (xml response)
$getresponse = curl_exec ($ch);
echo $getresponse;
// CLOSE THE SESSION
curl_close($ch);
Bob
Twenty-First Century
website: http://www.21stcenturycompany.com
email: tfc@21stcenturycompany.com
phone: (888) 961-6677
fax: (805) 964-5007
October 16th, 2007 at 11:23 pm
Good article, but I am getting a wrong parameter error for curl_exec(). Writing curl_exec($ch) returns an empty page, and if curl_exec() is left empty without any parameter, it gives a wrong parameter error.
November 8th, 2007 at 8:22 pm
for some reason i’m getting the same page back and my values for the form inputs are just placed into the form. any reason why i’d receive the same page back?
August 3rd, 2009 at 2:53 am
How to start with Curl learning any step by step guide?
May 8th, 2011 at 10:33 pm
Omg you are on the dot we are going to post to Tweets and Fb Using curl with PHP Tutorial | PHPkitchen is cool BTW our prayers to the people close by Japan hopefully your are well as well as secure too ? Salam ! Rob Rasner Wikipedia
November 28th, 2011 at 6:15 am
Thanks a lot..Nice article
June 21st, 2012 at 12:23 pm
how to get links and details from a webpage and post them to other webpage with cURL ?