Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function sendSMS($username, $password, $sender, $message, $phoneNumber) { $xml = new SimpleXMLElement('<InforuRoot/>'); $inforu = $xml->addChild('Inforu'); $user = $inforu->addChild('User'); $user->addChild('Username', $username); $user->addChild('Password', $password); $settings = $inforu->addChild('Settings'); $settings->addChild('Sender', $sender); $content = $inforu->addChild('Content'); $content->addAttribute('Type', 'sms'); $content->addChild('Message', $message); $recipients = $inforu->addChild('Recipients'); $recipients->addChild('PhoneNumber', $phoneNumber); $xmlString = urlencode($xml->asXML()); $url = "http://api.inforu.co.il/SendMessageXml.ashx?InforuXML=" . $xmlString; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); return $response; } $username = "VishClean"; $password = "Vish@@2023"; $sender = "VishClean"; $message = "test"; $phone = "0506487448"; $response = sendSMS($username, $password, $sender, $message, $phone); echo "<pre>$response</pre>"; ?>
Copy Clear