Tizag.com Webmaster Tutorials - A collection of webmaster tutorials from HTML to PHP.

Thursday, April 2, 2009

CURL programming

$name = $formdata['user_name'];
$email = $formdata['email'];
$password = $password_email;
$curlPost = 'txtName=' . urlencode($name) . '&txtEmail=' . urlencode($email).'&txtPassword='.urlencode($password);
echo $curlPost;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.thewebsitename.com/datainsert.php');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
//$postresponse = curl_exec ($ch);
$data = curl_exec($ch);
curl_close($ch);

No comments: