using curl as post
First of all know this code work for something with no captcha
here how it goes
$url = "http://someurl.com";
$ch = curl_init();
The url is to specify the link for the post
// howmany parameter to post
curl_setopt($ch, CURLOPT_POST, 3);
// the parameter 'username' with its value 'johndoe'
curl_setopt($ch, CURLOPT_POSTFIELDS,"name=".$name."&username=".$username.."&email=".$email);
//TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result= curl_exec ($ch);
curl_close ($ch);
We can also add some settings which can be useful , for instance to ignore redirection in the url we can add
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
Here is a link of the set of the things we can add
http://ca3.php.net/manual/en/function.curl-setopt.php
This entry was posted on Monday, January 25th, 2010 at 1:51 pm and is filed under php. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
