Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $json_url = "http://api.ebulksms.com:8080/sendsms.json";
- $xml_url = "http://api.ebulksms.com:8080/sendsms.xml";
- $http_get_url = "http://api.ebulksms.com:8080/sendsms";
- $username = '';
- $apikey = '';
- if (isset($_POST['button'])) {
- $username = $_POST['username'];
- $apikey = $_POST['apikey'];
- $sendername = substr($_POST['sender_name'], 0, 11);
- $recipients = $_POST['telephone'];
- $message = $_POST['message'];
- $flash = 0;
- if (get_magic_quotes_gpc()) {
- $message = stripslashes($_POST['message']);
- }
- $message = substr($_POST['message'], 0, 160);
- $result = doPostRequest($http_get_url, $username, $apikey, $flash, $sendername, $message, $recipients);
- }
- //Function to connect to SMS sending server using HTTP POST
- function doPostRequest($http_get_url, $arr_params, $headers = array('Content-Type: application/x-www-form-urlencoded')) {
- $response = array();
- $final_url_data = $arr_params;
- if (is_array($arr_params)) {
- $final_url_data = http_build_query($arr_params, '', '&');
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "{$url}?{$query_str}");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $output = curl_exec($ch);
- curl_close($ch);
- return $output;
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>EbulkSMS Send SMS API Sample</title>
- </head>
- <body>
- <h2 style="text-align: center">Ebulk SMS Integration Sample Code</h2>
- <div style="border: 1px solid #333; padding: 5px 10px; width: 40%; margin: 0 auto">
- <form id="form1" name="form1" method="post" action="">
- <?php
- if (!empty($_POST)) {
- if ($result == 'SUCCESS') {?>
- <p style="border: 1px dotted #333; background: #33ff33; padding: 5px;">Message sent</p>
- <?php
- }
- else {?>
- <p style="border: 1px dotted #333; background: #FFDACC; padding: 5px;">Message not sent - <?php echo $result;?></p>
- <?php
- }
- }
- ?>
- <p>
- <label>Username:
- <input name="username" type="text" id="username"/>
- </label>
- </p>
- <p>
- <label>API Key:
- <input name="apikey" type="password" id="passwd" />
- </label>
- </p>
- <p>
- <label>Sender name:
- <input name="sender_name" type="text" id="name" value="Integration" />
- </label>
- </p>
- <p>
- <label>Recipients
- <textarea name="telephone" id="telephone" cols="45" rows="2"></textarea>
- </label>
- </p>
- <p>
- <label>Message
- <textarea name="message" id="message" cols="45" rows="5"></textarea>
- </label>
- </p>
- <p>
- <label>
- <input type="submit" name="button" id="button" value="Submit" />
- </label>
- <label>
- <input type="reset" name="button2" id="button2" value="Reset" />
- </label>
- </p>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement