Jump to content

PHP and sms


omides_86

Recommended Posts

can anyone help me with this coding

 

 

<?php

 

########################################################

# Login information for the SMS Gateway

########################################################

 

$ozeki_url = "http://203.217.178.124:8080/15888v3/smsgateway/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, 30);

    if (!$fp) {

      return("$errstr ($errno)");

    } else {

        $out = "GET /$args[3] HTTP/1.1 200 OK\r\n";

        $out .= "Host: $args[1]:$args[2]\r\n";

        $out .= "deliver : 0\r\n";

$out .= "StatusCode : 200\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, $keyword, $smsid, $shortcode, $debug=false){

      global $ozeki_url;

 

  $url = '&keyword='.urlencode($keyword);

  $url.= '&smsid='.urlencode($smsid);

  $url.= '&shortcode='.urlencode($shortcode);

      $url.= '&sender='.urlencode($phone);

      $url.= '&details='.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 send_sms.php

########################################################

 

$phonenum = $_POST['sender'];

$message = $_POST['details'];

$keyword = $_POST['keyword'];

$shortcode = $_POST['shortcode'];

$smsid = $_POST['smsid'];

$debug = true;

 

ozekiSend($phonenum,$message,$keyword,$smsid,$shortcode,$debug);

 

?>

 

 

when i run this coding

 

this is the result that i have

 

 

Request:

http://203.217.178.124:8080/15888v3/smsgateway/send_sms.php&keyword=MOF&smsid=209&shortcode=15888&sender=0192263901&details=try++test

 

Response:

 

Connection timed out (110)

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/234815-php-and-sms/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.