Hello,
<?php
########################################################
# Login information for the SMS Gateway
########################################################
$ozeki_user = "0013246594464";
$ozeki_password = "password";
$ozeki_url = "https://sms.xxxxx.com/send_sms.php?";
########################################################
# Functions used to send the SMS message
########################################################
function httpRequest($url){
$pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/";
preg_match($pattern,$url,$args);
$in = "";
$fp = fsockopen($args[1], $args[2], $errno, $errstr, 60);
if (!$fp) {
return("$errstr ($errno)");
} else {
$out = "GET /$args[3] HTTP/1.1\r\n";
$out .= "Host: $args[1]:$args[2]\r\n";
$out .= "User-agent: Ozeki PHP client\r\n";
$out .= "Accept: */*\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$in.=fgets($fp, 128);
}
}
fclose($fp);
return($in);
}
function ozekiSend($phone, $msg, $debug=false){
global $ozeki_user,$ozeki_password,$ozeki_url;
$url = 'username='.$ozeki_user;
$url.= '&password='.$ozeki_password;
$url.= '&mesg_to='.urlencode($phone);
$url.= '&mesg='.urlencode($msg);
$urltouse = $ozeki_url.$url;
if ($debug) { echo "Request: <br>$urltouse<br><br>"; }
//Open the URL to send the message
$response = httpRequest($urltouse);
if ($debug) {
echo "Response: <br><pre>".
str_replace(array("<",">"),array("<",">"),$response).
"</pre><br>"; }
return($response);
}
########################################################
# GET data from sendsms.html
########################################################
$phonenum = $_POST['recipient'];
$message = $_POST['message'];
$debug = true;
ozekiSend($phonenum,$message,$debug);
?>
I've a html form sendsms.html and the above code in sendsms.php. After entering details and clicking send in http:/xxxx.com/sendsms.html it goes to http:/xxxx.com/sendsms.php and in this page it displays
Request:
https://sms.xxxx.com/send_sms.php?username=0013246594464&password=password&mesg_to=919985673219&mesg=Hello=Lamiv+this+is+a+test+message
Warning: fsockopen() expects parameter 2 to be long, string given in /home/www/xxxx.com/sendsms.php on line 18
Response:
()
Please help.