Send an SMS using way2sms in PHP

djmmt9999

New Member
I want to send an SMS using way2sms in PHP. I've got an error message: "Request Sent (please see delivery report)! but message is not sent on mobile"Below is my code, please advise me.data.php\[code\]<html><head> <title></title></head><body> <form name="contactform" method="post" action="send.php"> <label for="telephone">Telephone Number</label> <input type="text" name="telephone" maxlength="30" size="30"> <label for="message">Message</label> <textarea name="message" cols="25" rows="6"></textarea> <input type="submit" value="http://stackoverflow.com/questions/15476374/Submit" name="submit"> </form></body></html>\[/code\]send.php\[code\]<?php $telephone = $_POST['telephone']; $message = $_POST['message']; $from = "9545189737"; // This is who the message appears to be from. $to = "8796212773"; $username = "USERNAME"; // insert your username $pword = "PASSWORD"; //Your developer API password $hash = "abcdb"; //Do not change $sourceinfo = "1"; //Display POST info $url = 'http://sourcesms.com/api/api-function.php'; $fields = array('from'=>urlencode($from),'to'=>urlencode($to),'message'=>urlencode($message),'username'=>urlencode($username),'pword'=>urlencode($pword),'hash'=>urlencode($hash),'sourceinfo'=>urlencode($sourceinfo)); foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch);?>\[/code\]
 
Back
Top