943,832 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 3212
  • PHP RSS
You are currently viewing page 4 of this multi-page discussion thread; Jump to the first page
Mar 12th, 2008
0

Re: A little problem with a script

Hey Guys.Good news.Problem solved.Thank you all for the help and special thanks to Designer_101.I got immediate results after instaling wamp server and now I can continue my work.Users inserted successfully and no blank pages.Thanks again and Peace to you all.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tedobg is offline Offline
23 posts
since Jan 2008
Mar 12th, 2008
0

Re: A little problem with a script

no problem m8. Btw can i ask how old u r...earlier you said you had 2 go 2 school? im 14
Reputation Points: 12
Solved Threads: 16
Posting Whiz
Designer_101 is offline Offline
314 posts
since Jul 2007
Mar 12th, 2008
0

Re: A little problem with a script

Designer mate sorry I didn't answer immediately but I was having diner.Well I am 16... PM me later we can talk mate. Right now I am marking this as solved thanks again.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tedobg is offline Offline
23 posts
since Jan 2008
Dec 19th, 2008
0

Re: A little problem with a script

can any buddy help me!!!

this is my php sms sending script but i cant send it.
for sending sms any setting reqire?

php Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3. <head>
  4. <title>Send SMS from your web page</title>
  5. </head>
  6. <body>
  7. <?php
  8.  
  9. $footer = 'Your footer text';
  10. $maxSizeSms = 160 - strlen($footer);
  11.  
  12.  
  13.  
  14. DEFINE('API_USER', 'ts_ravie');
  15. DEFINE('API_PWD', 'rav@34');
  16. DEFINE('API_receipt', 'Yes');
  17. DEFINE('API_sender', 'Ravience');
  18.  
  19.  
  20. // check if form has been "posted"
  21. if( isset($_GET['mobile']) && isset($_GET['sms']) ){
  22.  
  23. // phone number and message (message + footer)
  24. preg_match_all('/[\d]{11}/', $_GET['mobile'], $mobile);
  25. $sms = urlencode(substr($_GET['sms'], 0, $maxSizeSms).$footer);
  26.  
  27. // URL for sending the SMS
  28. $apiCallUrl = 'http://122.169.193.83:8888/?';
  29. $apiCallUrl .= 'User='.API_USER.'&Password='.API_PWD.'&ReceiptRequested='.API_receipt.'&sender='.API_sender;
  30. $apiCallUrl .= '&PhoneNumber='.$_GET['mobile'].'&Text='.$sms;
  31.  
  32.  
  33.  
  34. $curlHandle = curl_init();
  35.  
  36.  
  37. curl_setopt($curlHandle, CURLOPT_URL, $apiCallUrl);
  38.  
  39. curl_setopt($curlHandle, CURLOPT_HEADER, 0);
  40.  
  41. curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
  42.  
  43. curl_setopt($curlHandle, CURLOPT_POST, 1);
  44.  
  45. curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);
  46.  
  47. curl_setopt($curlHandle, CURLOPT_TIMEOUT, 15);
  48.  
  49.  
  50. $content = curl_exec($curlHandle); // Make the call for sending the SMS
  51.  
  52. curl_close($curlHandle); // Close the connection to Clickatell
  53.  
  54. if( preg_match('/^ID:/', $content) ){
  55. echo '<h2>Message have been sent</h2>';
  56. }else{
  57. echo '<h2>Error sending message</h2>';
  58. }
  59. }
  60. ?>
  61.  
  62.  
  63.  
  64. <form method="get" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
  65.  
  66. Phone number <br />
  67. <input type="text" name="mobile" size="20" maxlength="12" value="" />
  68. <br />
  69.  
  70. Message <br />
  71. <input type="text" name="sms" size="30" maxlength="<?php echo $maxSizeSms ?>" value="" />
  72.  
  73. <br />
  74.  
  75. <input type="submit" value="Send SMS" />
  76.  
  77. </form>
  78.  
  79. </body>
  80. </html>
Last edited by peter_budo; Dec 21st, 2008 at 3:59 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
patel manish is offline Offline
2 posts
since Nov 2007
Dec 19th, 2008
0

Re: A little problem with a script

can any buddy help me!!!

this is my php sms sending script but i cant send it.
for sending sms any setting reqire?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Send SMS from your web page</title>
</head>
<body>
<?php

$footer = 'Your footer text';
$maxSizeSms = 160 - strlen($footer);



DEFINE('API_USER', 'ts_ravie');
DEFINE('API_PWD', 'rav@34');
DEFINE('API_receipt', 'Yes');
DEFINE('API_sender', 'Ravience');


// check if form has been "posted"
if( isset($_GET['mobile']) && isset($_GET['sms']) ){

// phone number and message (message + footer)
preg_match_all('/[\d]{11}/', $_GET['mobile'], $mobile);
$sms = urlencode(substr($_GET['sms'], 0, $maxSizeSms).$footer);

// URL for sending the SMS
$apiCallUrl = 'http://122.169.193.83:8888/?';
$apiCallUrl .= 'User='.API_USER.'&Password='.API_PWD.'&ReceiptRequested='.API_receipt.'&sender='.API_sender;
$apiCallUrl .= '&PhoneNumber='.$_GET['mobile'].'&Text='.$sms;



$curlHandle = curl_init();


curl_setopt($curlHandle, CURLOPT_URL, $apiCallUrl);

curl_setopt($curlHandle, CURLOPT_HEADER, 0);

curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curlHandle, CURLOPT_POST, 1);

curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);

curl_setopt($curlHandle, CURLOPT_TIMEOUT, 15);


$content = curl_exec($curlHandle); // Make the call for sending the SMS

curl_close($curlHandle); // Close the connection to Clickatell

if( preg_match('/^ID:/', $content) ){
echo '<h2>Message have been sent</h2>';
}else{
echo '<h2>Error sending message</h2>';
}
}
?>



<form method="get" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">

Phone number <br />
<input type="text" name="mobile" size="20" maxlength="12" value="" />
<br />

Message <br />
<input type="text" name="sms" size="30" maxlength="<?php echo $maxSizeSms ?>" value="" />

<br />

<input type="submit" value="Send SMS" />

</form>

</body>
</html>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
patel manish is offline Offline
2 posts
since Nov 2007
Dec 22nd, 2008
0

Re: A little problem with a script

Click to Expand / Collapse  Quote originally posted by tedobg ...
Hi guys.I am new to web development and of course I have been experiensing some problems.Most of them are easy to solve and I usually find my way, but there is some thing that is getting on my nerves for some time now.

I have been trying to make a simple script for registering a user via MySQL.No filtering input, no validating only the part that adds the new user into the MySQL table. But it doesn't work.I have checked my code a couple of times and i can't see the problem.Here it is:
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. if(isset($_POST["name"]) && isset($_POST["pass"]) && isset($_POST["email"]))
  3. {
  4. $name=$_POST["name"];
  5. $pass=$_POST["pass"];
  6. $email=$_POST["email"];
  7. $con=mysql_connect('localhost','root','password');
  8. if (!$con)
  9. {
  10. die('Could not connect: ' . mysql_error());
  11. }
  12. mysql_select_db("users", $con);
  13. mysql_query("INSERT INTO members (username,password,email) values ('$name','$pass','$email')") or die('Error');
  14. }
  15. ?>

Hi,
You have get name,pass,email in a html form using a submit button and then later you have to post the details using $post

See the form given below

PHP Syntax (Toggle Plain Text)
  1. <form name="form1" method="post" action="">
  2. Name
  3. <input type="text" name="Name" value="">
  4. Pass
  5. <input type="password" name="Pass" value="">
  6. Email
  7. <input type="text" name="Email" value="">
  8. <input type="submit" name="Submit" value="Submit">
  9. </form>
  10. <?
  11. if(isset($_POST['Submit'']))
  12. {
  13. $name=$_POST['Name'];
  14. $pass=$_POST['Pass'];
  15. $email=$_POST['Email'];
  16. $con=mysql_connect('localhost','root','password');
  17. if (!$con)
  18. {
  19. die('Could not connect: ' . mysql_error());
  20. }
  21. mysql_select_db("users", $con);
  22. mysql_query("INSERT INTO members (username,password,email) values ('$name','$pass','$email')") or die('Error');
  23. }
  24.  

I think it should be work!
Last edited by peter_budo; Dec 23rd, 2008 at 6:56 pm. Reason: Adding code tag
Reputation Points: 10
Solved Threads: 1
Newbie Poster
ashafaaiz is offline Offline
20 posts
since Dec 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP sort control
Next Thread in PHP Forum Timeline: Ajax Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC