3v4l.org

run code in 300+ PHP versions simultaneously
<?php //////============================== //*********** echo "what now"; class SendSMSclass { //input parameters --------------------- var $username; //your username var $password; //your password var $sender; //sender text var $message; //message text var $flash; //Is flash message (1 or 0) var $inputgsmnumbers = array(); //destination gsm numbers var $type; //msg type ("bookmark" - for wap push, "longSMS" for text messages only) var $bookmark; //wap url (example: www.google.com) //-------------------------------------- var $host; var $path; var $XMLgsmnumbers; var $xmldata; var $request_data; var $response; function SendSMS($username, $password, $sender, $message, $flash, $inputgsmnumbers, $type, $bookmark) { $this->username = $username; $this->password = $password; $this->sender = htmlspecialchars($sender, ENT_QUOTES); $this->message = htmlspecialchars($message, ENT_QUOTES); $this->flash = $flash; $this->inputgsmnumbers = $inputgsmnumbers; $this->type = $type; $this->bookmark = $bookmark; $this->host = "api2.infobip.com"; $this->path = "/api/sendsms/xml"; $this->convertGSMnumberstoXML(); $this->prepareXMLdata(); $this->response = $this->doPost($this->path,$this->request_data,$this->host); return $this->response; } function convertGSMnumberstoXML() { $gsmcount = count($this->inputgsmnumbers); #counts gsm numbers for ( $i = 0; $i < $gsmcount; $i++ ) { $this->XMLgsmnumbers .= "<gsm>" . $this->inputgsmnumbers[$i] . "</gsm>"; } } function prepareXMLdata() { $this->xmldata = "<SMS><authentification><username>" . $this->username . "</username><password>" . $this->password . "</password></authentification><message><sender>" . $this->sender . "</sender><text>" . $this->message . "</text><flash>" . $this->flash . "</flash><type>" . $this->type . "</type><bookmark>" . $this->bookmark . "</bookmark></message><recipients>" . $this->XMLgsmnumbers . "</recipients></SMS>"; $this->request_data = 'XML=' . $this->xmldata; } function doPost($uri,$postdata,$host){ $da = fsockopen($host, 80, $errno, $errstr); if (!$da) { return "$errstr ($errno)"; } else { $salida ="POST $uri HTTP/1.1\r\n"; $salida.="Host: $host\r\n"; $salida.="User-Agent: PHP Script\r\n"; $salida.="Content-Type: text/xml\r\n"; $salida.="Content-Length: ".strlen($postdata)."\r\n"; $salida.="Connection: close\r\n\r\n"; $salida.=$postdata; fwrite($da, $salida); while (!feof($da)) $response.=fgets($da, 128); $response=split("\r\n\r\n",$response); $header=$response[0]; $responsecontent=$response[1]; if(!(strpos($header,"Transfer-Encoding: chunked")===false)){ $aux=split("\r\n",$responsecontent); for($i=0;$i<count($aux);$i++) if($i==0 || ($i%2==0)) $aux[$i]=""; $responsecontent=implode("",$aux); }//if return chop($responsecontent); }//else } } // *************** //$mygsm= $_SESSION['gsm']; //$myprovider = $_SESSION['provider'] ; //$myproviderpassword = $_SESSION['providerpassword'] ; //$mygsmchallenge= $_SESSION['gsmchallenge'] ; $mygsm= "254720219320" ; $myprovider = "mitambo"; $myproviderpassword = "peter123"; $mygsmchallenge= "hola" ; $gsm = array(); $gsm[0] = $mygsm ; $username =$myprovider ; $password =$myproviderpassword ; $sender = "Psq"; $isflash = 0; $type ="longSMS" ; $bookmark = "what mark"; $messagetext = "psq: Write GSM code ".$mygsmchallenge." in your computer and click log in" ; // Note: replace sign "+" with "%2b" for sender and message text or it will be replaced with empty space $sender = str_replace("+","%2b",$sender); $messagetext = str_replace("+","%2b",$messagetext); $SENDSMS = new SendSMSclass(); $response = $SENDSMS->SendSMS($username,$password,$sender,$messagetext,$isflash, $gsm, $type, $bookmark); //IsFlash must be 0 or 1 //echo $response; ?>
Output for git.master, git.master_jit, rfc.property-hooks
what now Warning: fsockopen(): php_network_getaddresses: getaddrinfo for api2.infobip.com failed: System error in /in/t2ITg on line 68 Warning: fsockopen(): Unable to connect to api2.infobip.com:80 (php_network_getaddresses: getaddrinfo for api2.infobip.com failed: System error) in /in/t2ITg on line 68

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.62 ms | 401 KiB | 8 Q