SMS API HELP
Posted: Fri Sep 04, 2009 3:49 pm
A
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Well, no, it won't work.php_new_guy_09 wrote:i would just like to know if the code i posted will work and if not, where have i made mistakes.
Code: Select all
<?php
$uname = "youremailaddress";
$pword = "yourpassword";
$database="my database";
$sender = $_REQUEST['sender'];
$content = $_REQUEST['content'];
$from = " php_new_guy_09";
$selectednums = $sender;
$message = AUTOREPLY CONTENT;
$message = urlencode($message);
mysql_connect(localhost,$username,$password); // localhost is not a constant. where's $username? $password?
mysql_select_db($database);
INSERT INTO log (sender,content) VALUES ('$sender','$content'); // not php code
$query="SELECT $sender, $content FROM log "; // horrible, horrible idea - see below
$result=mysql_query($query);
$content ^ sunrise // not a php statement. what is this supposed to be?
SELECT '$content', FROM autoreplymsg WHERE content ='sunrise'
ORDER BY RAND()
LIMIT 1 // not php code, invalid sql
$data = "uname=".$uname."&pword=".$pword."&message=".$message."&from=". $from."&selectednums=".$selectednums."&info=".$info."&test=".$test;
$ch = curl_init('http://www.txtlocal.com/sendsmspost.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
mysql_close();
?>Code: Select all
$query="SELECT $sender, $content FROM log ";