p_tru Posted March 11, 2006 Share Posted March 11, 2006 i'm trying to send a text message using a url but it doesn't seem to be working and i can't see errors in my coding, can someone help me i would be very grateful.[code]<?php //connect to databaseinclude 'db.private'; $connection = mysql_connect($hostname,$username,$pwd)or die(mysql_error()); mysql_select_db($databaseName, $connection)or die(mysql_error()); SESSION_START();if ($_SESSION[validated] == "yes") {//a if (isset($_POST['Submit'])) {//b$user = "john";$password = "boy";$api_id = "198";$baseurl ="http://api.clickatell.com";$text = urlencode("You have successfully booked your seat");$to = "44784552";// auth call$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";// do auth call$ret = file($url);// split our response. return string is on first line of the data returned$sess = split(":",$ret[0]);if ($sess[0] == "OK") {//c$sess_id = trim($sess[1]); // remove any whitespace$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";// do sendmsg call$ret = file($url);$send = split(":",$ret[0]);if ($send[0] == "ID") echo "success<br>message ID: ". $send[1]; else echo "send message failed"; } //c else { echo "Authentication failure: ". $ret[0]; exit(); }}//b//a}else { echo "you have not logged in";}?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/4655-problems-with-loading-a-url-to-send-a-txt-msg/ Share on other sites More sharing options...
hitman6003 Posted March 11, 2006 Share Posted March 11, 2006 Don't post usernames, passwords, or phone numbers in your posts.Echo out your $url variables to ensure that they are correct and that nothing is failing with those. I don't know where your located, but if it's in the US, you don't have enough numbers in the phone number to send the message...I'm sure since it's a url you'll need an area code. Come to think of it, you'll probably need to ad some additional numbers regardless of where you are. Local numbers will not work with something like that, you may even need a country code. Quote Link to comment https://forums.phpfreaks.com/topic/4655-problems-with-loading-a-url-to-send-a-txt-msg/#findComment-16287 Share on other sites More sharing options...
p_tru Posted March 11, 2006 Author Share Posted March 11, 2006 k thanks, i'll give that a go. thanks for the tip. Quote Link to comment https://forums.phpfreaks.com/topic/4655-problems-with-loading-a-url-to-send-a-txt-msg/#findComment-16299 Share on other sites More sharing options...
p_tru Posted March 11, 2006 Author Share Posted March 11, 2006 it still doesn't work. i can't seem to be able to echo out the url.and all the username and password numbers have been edited just to give people an idea on what should be in those variables. Quote Link to comment https://forums.phpfreaks.com/topic/4655-problems-with-loading-a-url-to-send-a-txt-msg/#findComment-16462 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.