Calling API's using CURL in php.
$message = "This is test message.";
$enc_msg= rawurlencode($message);
//Create API URL
$fullapiurl="http://173.45.76.227/sendunicode.aspx?username=USERNAME&pass=PASSWORD&route=trans1&senderid=SENDERID&numbers=MOBILENO&message=$enc_msg";
//Calling API
$ch = curl_init($fullapiurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Calling API using curl. This will actually calls the API and store the response into $result variable which you can use in further operations.
$result = curl_exec($ch);
echo $result ;
curl_close($ch);
Comments
Post a Comment