Sample CURL PHP

Image Description
<?php
$MSISDN = "94775553892";
$MESSAGE = "Test";
$USERNAME = "xxxxx";
$PWD = "xxxxx";
$SRC = "xxxxx";


$url = 'http://sms.textware.lk:5000/sms/send_sms.php';
$myvars = 'username=' . $USERNAME . '&password=' . $PWD . '&src=' . $SRC . '&dst=' . $MSISDN . '&msg=' . $MESSAGE;

$ch = curl_init( $url );

curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );

echo $response;

?>

Was this article helpful to you?

Yes No

Related Articles