curl in php using post method

hello friends now i work with navdeep bagga .navdeep is my monitor and they create one api and plugin with help send the sms.in this api they face some error .this api not work with diffrent servers .i and my partner robin update this api using of curl.

i work on this library before one year .but i not impalement in any project now be have chance to do this i add this function in api

install cyrl library in ubantu by this comand

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl.

this page name is sendsms.php

<?php

function sensms($number,$message)
{
$n=”hitesh”;
$hj=’number=0000000000′.’&message=’.$n;
$con=curl_init();
curl_setopt($con,CURLOPT_URL,’http:example.php/Index.php’);
curl_setopt($con,CURLOPT_POST,TRUE);
curl_setopt($con,CURLOPT_POSTFIELDS,$hj);
curl_setopt($con,CURLOPT_RETURNTRANSFER,TRUE);
$f=curl_exec($con);
curl_close($con);
echo $f;
}

?>

this page is index.php

<?php

echo $_POST[‘number’];

echo $_POST[‘message’];

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s