3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 = "what now ".$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 5.2.6 - 5.6.28, 7.0.0 - 7.1.0
what now Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/8n10D on line 68
Output for hhvm-3.10.0 - 3.12.0
what now
Output for 5.1.3 - 5.2.5
what now Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 (Unknown error) in /in/8n10D on line 68
Output for 5.0.3 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 12 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 13 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 14 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 15 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 16 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 17 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 18 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 19 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 22 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 23 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 24 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 25 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 26 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 27 what now Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 (Unknown error) in /in/8n10D on line 68
Output for 5.0.0 - 5.0.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 12 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 13 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 14 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 15 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 16 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 17 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 18 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 19 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 22 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 23 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 24 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 25 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 26 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8n10D on line 27 what now Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 (Unknown error) in /in/8n10D on line 68
Output for 4.3.3 - 4.3.4, 4.3.10 - 4.4.9
what now Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 in /in/8n10D on line 68
Output for 4.3.5 - 4.3.9
what now Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 in /in/8n10D on line 68
Output for 4.3.2
what now Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /in/8n10D on line 68 Warning: fsockopen(): unable to connect to api2.infobip.com:80 in /in/8n10D on line 68
Output for 4.3.0 - 4.3.1
what now
Process exited with code 139.