Jump to content

related with passing variables in url


madhmad

Recommended Posts

i hav this url n whenever i click on this url i get som mssg send on my mobile

i hav a form whose code is

<form action="formprocess.php method="post">
telephone<input type="text name="telephone>
<input type="submit" name="submit">
</form>

 

 

i want to send telephone as parameter to this url so whenever user enters his telephone he gets d mssg

after clicking on submit.....but i hav no idea how to do tht...help me somone plssssssss

 

http://www.abc.in/smsapi/sendsms.php?sendto=9987234123&msg=your

Link to comment
Share on other sites

You could do it using the form like

<html>
<head>
<title></title>
</head>
<body>

<form action="http://www.abc.in/smsapi/sendsms.php" method="get">
telephone:<input type="text" name="sendto">
message:<input type="text" name="msg">
<input type="submit" name="" value="Send Message">
</form>

</body>

 

Or if you want it to go to your own script which then makes the request you would have something like this

 

If curl isnt installed:

<?php
if (isset($_POST['sendto']))
{
$sendto = $_POST['sendto'];
}
if (isset $_POST['message'])
{
$message = $_POST['message'];
}

//Do some validation on input

$api_address = "http://www.abc.in/smsapi/sendsms.php"

get_headers($api_address.'?'.'sendto='.$sendto.'&msg='.urlencode($message));

 

if it is

<?php
if (isset($_POST['sendto']))
{
$postdata['sendto'] = $_POST['sendto'];
}
if (isset $_POST['message'])
{
$postdata['message'] = $_POST['message'];
}

//Do some validation on input

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://www.abc.in/smsapi/sendsms.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);

curl_exec($ch);

curl_close($ch);

 

I havent tested this code but it *should* /hopefully/ work :)

Link to comment
Share on other sites

hey ur code is fine.....i m able to send sms to the number given by user...but wht i want is tht user doesnt give the mssg on his own...i want to send a random number to the user n tht random number gets stored inmy database as well......so far my code is

<html>
<head>
<title></title>
</head>
<body>
srand ((double) microtime( )*1000000);

$random_number = rand( );

<form action="http://www.bluled.in/smsapi/sendsms.php" method="get">
telephone:<input type="text" name="sendto">



message:<input type="text" name="msg">
<input type="submit" name="" value="Send Message">
</form>

</body>

 

can u help me wid dis pls

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.