Welcome Guest, Not a member yet? Register   Sign In
Sending message to a mobile number via fsockopen
#1

[eluser]tochie[/eluser]
Hello,

This is my problem. I want to send a sms message via a host on another domain. I'm supposed to call a page and send variables, then get a response on the status of message I sent. The error message i get says: "Bad Request".

This is my code:

Code:
$sms_host = 'sms.abc.com';       //sms processing gateway
$str = "/abc/abc.asp?";      //path to script  
$str .= "username=abc&";             //the required parameters >> downwards
$str .= "password=abc&";
$str .= "message=testing&";          
$str .= "mobile=3667348829&";
$str .= "sender=CallBackNow&";
$str .= "type=0";

$request = "GET " . $str . " HTTP/1.1\r\n";  
$request .= 'Host: '.$sms_host.' \r\n';
$reply = "";  

$fp = fsockopen($sms_host, 80, $errno, $errstr, 30);
if (!$fp)
{
    echo "$errstr ($errno)<br />\n";
}
else
{
    fwrite($fp, $request);
    
    while (!feof($fp)) {
        $reply =  fgets($fp, 128);
    }
    
    fclose($fp);
}

Any suggestions, Please?

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB