Jump to content

PHPClueless

New Members
  • Posts

    3
  • Joined

  • Last visited

PHPClueless's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It does not give me an error message just a blank screen with the url http://xyz.com/xy2p1.php?date=asd&time=asd&pua=sad&doa=sad&passenger=&pax= If I use the basic PHP script it will work but I obviously need more functionality.
  2. Thanks for your reply! The script sends the data to an API for SMSbroadcast.com.au to send out to my drivers. The stock PHP from SMS Broadcast is: <?php function sendSMS($content) { $ch = curl_init('https://api.smsbroadcast.com.au/api-adv.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $content); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec ($ch); curl_close ($ch); return $output; } $username = 'USERNAME'; $password = 'PASSWORD'; $destination = '0400000000'; //Multiple numbers can be entered, separated by a comma $source = 'MyCompany'; $text = 'This is our test message.'; $ref = 'abc123'; $content = 'username='.rawurlencode($username). '&password='.rawurlencode($password). '&to='.rawurlencode($destination). '&from='.rawurlencode($source). '&message='.rawurlencode($text). '&ref='.rawurlencode($ref); $smsbroadcast_response = sendSMS($content); $response_lines = explode("\n", $smsbroadcast_response); foreach( $response_lines as $data_line){ $message_data = ""; $message_data = explode(':',$data_line); if($message_data[0] == "OK"){ echo "The message to ".$message_data[1]." was successful, with reference ".$message_data[2]."\n"; }elseif( $message_data[0] == "BAD" ){ echo "The message to ".$message_data[1]." was NOT successful. Reason: ".$message_data[2]."\n"; }elseif( $message_data[0] == "ERROR" ){ echo "There was an error with this request. Reason: ".$message_data[1]."\n"; } } ?> What I need is the various fields entered in the HTML to be combined on in the $text field as sent out as a message. I hope this makes sense.
  3. Firstly thank you for looking at this issue. I have very basic understanding on HTML and even less of PHP. I have set up two files on a test server with an API send to a SMS broadcast however the test messages are not displaying the data entered in the HTML form. I am sure the issue is probably incorrect formatting but I have sat here for two hours trying combinations without success. Basically I need a HTML form that an operator enters data and it sends this in a SMS via API using a PHP script. There is more I need to do to this script but If i get the basics issue here answered I might be able to navigate my way through Please see below: HTML FORM: <html> <body> <form action="xy2p1.php" method="get"> Pick Up Date: <input type="text" name='date'><br> Pick Up Time: <input type="text" name='time'><br><br> Pickup Address: <input type="text" name='pua'><br> Drop Of Address: <input type="text" name='doa'><br> Passenger: <input type="text" name='passenger'><br> No of Pax : <input type="text" name='pax'><br> <input type="submit"> </body> </form> </html> now this should send the data to the PHP file which is named as per the form action above. PHP FILE <?php function sendSMS($content) { $ch = curl_init('https://api.smsbroadcast.com.au/api-adv.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $content); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec ($ch); curl_close ($ch); return $output; } $username = 'xxxxx'; $password = 'xxxx'; $destination = 'xxxx'; $source = 'SampleCompany'; $text = 'date','time','pua','doa','passenger','pax'; $ref = 'abc123'; $content = 'username='.rawurlencode($username). '&password='.rawurlencode($password). '&to='.rawurlencode($destination). '&from='.rawurlencode($source). '&message='.rawurlencode($text). '&ref='.rawurlencode($ref); $smsbroadcast_response = sendSMS($content); $response_lines = explode("\n", $smsbroadcast_response); foreach( $response_lines as $data_line){ $message_data = ""; $message_data = explode(':',$data_line); if($message_data[0] == "OK"){ echo "The message to ".$message_data[1]." was successful, with reference ".$message_data[2]."\n"; }elseif( $message_data[0] == "BAD" ){ echo "The message to ".$message_data[1]." was NOT successful. Reason: ".$message_data[2]."\n"; }elseif( $message_data[0] == "ERROR" ){ echo "There was an error with this request. Reason: ".$message_data[1]."\n"; } } ?> Any ideas where i am going wrong? Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.