Jump to content

Please Help with my sms app curl


Niki131

Recommended Posts

Hello, I'm new to lot of this and especially php.

 

I'm having hard time with one of my app that I created. 

If you go to ticketlawyerorlando.com/sms5.html and you try to send text, (which is set to go to only one number (mine)) than I get error code from php that is supposed to curl it. 

 

 

Error:

 

Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /home/content/s/j/1/sj10mil/html/ticketlawyerorlando/sms5.php on line 10

SUCCESS

 

My Html code is :

<html>
<body>
<br/>
<form action="sms5.php" method="post">
<b>Your Phone Number:</b> <input type="text" name="to" />
<br/>
<b>Message:</b> <input type="text" name="msg" />
<br/>
<input type="submit" />
</form>
</body>
</html> 

 

My sms5.php code is :

<html>
<head>
<title>SMS STATUS</title>
</head>
<body>
<?php
//print $to;
//print $msg;
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_GET,1);
curl_setopt($curl_handle, CURLOPT_URL,'https://api.tropo.com/1.0/sessions?to=3213314633&msg=test4&token=010fc32265db5444bbf84e92bd28f1887395ce3ade6cf69e1424d586add66b17bdc7c1d8061803f1c2319d66');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,2);
$response = curl_exec($curl_handle);
$code = curl_getinfo($curl_handle,CURLINFO_HTTP_CODE);
//print $code;
//print $response;
print "SUCCESS";
curl_close($curl_handle);
?>
</body>
</html> 

 

In my php, the URL that's being curled, in the part where it says "test4" that should be actual message that  is typed in the form but I don't know what kind of parameter to insert there in order for it to send message that's written, it always sends message "test4".

 

Please, if you could help me I would greatly appreciate it.

 

Thank You so much again.

 

 

MOD EDIT: code tags added

Link to comment
Share on other sites

Ok yes that's probably the problem, but can I input something there instead of the "Test4" part so it would show message?

 

That's the sms app code:

<?php
message("".$msg,
array(
  "to" => "+13213314633",
  "network" => "SMS"));
?>

 

So if I use

CURLOPT_POST ?

I tried that before nothing helped

 

MOD EDIT: code tags added.

Link to comment
Share on other sites

If I changed the sms5.php to:

 

<html>
<head>
<title>SMS STATUS</title>
</head>
<body>
<?php
//print $to;
//print $msg;
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_POST);
curl_setopt($curl_handle, CURLOPT_URL,'https://api.tropo.com/1.0/sessions?to=3213314633&msg=test4&token=010fc32265db5444bbf84e92bd28f1887395ce3ade6cf69e1424d586add66b17bdc7c1d8061803f1c2319d66');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,2);
$response = curl_exec($curl_handle);
$code = curl_getinfo($curl_handle,CURLINFO_HTTP_CODE);
//print $code;
//print $response;
print "SUCCESS";
curl_close($curl_handle);
?>
</body>
</html> 

 

I get this error:

Warning: Wrong parameter count for curl_setopt() in /home/content/s/j/1/sj10mil/html/ticketlawyerorlando/sms5.php on line 10

SUCCESS

 

 

Thank you for all your help again.

 

MOD EDIT: code tags added

Link to comment
Share on other sites

Line 10 is redundant.

 

CURLOPT_HTTPGET - TRUE to reset the HTTP request method to GET. Since GET is the default, this is only necessary if the request method has been changed.

 

As long as you have &msg=test4 in your CURLOPT_URL, all you will get is test4.

 

You want to sanitize (htmlentities) and make sure it's not to long, and then insert the message into your CURLOPT_URL query string

Link to comment
Share on other sites

Ok so should I insert CURLOPT_HTTPGET - TRUE somewhere in the php code?

 

Ok, i see that, so but if i delete that part, than it's not sending any kind of message.....I don't even know how to sanitize it correctly, I was told to use :

 

curl_setopt($curl_handle, CURLOPT_URL,'https://api.tropo.com/1.0/sessions?action=create&token=YOUR_TOKEN_GOES_HERE&to='.$to.'&msg='.$msg);  but that code wasn't working, insteas o Your Token GOes Here i put my token nubmer which is 010fc32265db5444bbf84e92bd28f1887395ce3ade6cf69e1424d586add66b17bdc7c1d8061803f1c2319d66 so resulting url should look something like this

 

'https://api.tropo.com/1.0/sessions?action=create&token=010fc32265db5444bbf84e92bd28f1887395ce3ade6cf69e1424d586add66b17bdc7c1d8061803f1c2319d66&to='.$to.'&msg='.$msg

 

right?

 

 

Link to comment
Share on other sites

Thank you for the reply again, I've been on that site too, it's just so new to me, I'm having hard time recreating that php code to make it work, is there any way you could show me an example of what it should look like for it to work? Please

 

Thank You so much again

Link to comment
Share on other sites

Then I'd be doing it for you, and you wouldn't learn anything.

 

The skills required to complete your task, given the information provided in this thread, are VERY BASIC. I'm here to help, not fix your scripts.

Link to comment
Share on other sites

Please, please, please help me, I promise you I will definitely learn a lot form it, I can compare the codes than and see what I was doing wrong, I promise.  Please I'll owe you a big one, I really need help with this Please.

 

THANK YOU so much again :)

Link to comment
Share on other sites

Like this:

<?php
if( $some_var == $some_value) {
     echo "Some random string";
}
?>

 

So the enclosed code is automatically syntax highlighted like this:

<?php
if( $some_var == $some_value) {
     echo "Some random string";
}
?>

Link to comment
Share on other sites

o ok, so here are my codes than:

 

 

sms5.php code:

 

<html>
<head>
<title>SMS STATUS</title>
</head>
<body>
<?php
//print $to;
//print $msg;
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_GET,1);
curl_setopt($curl_handle, CURLOPT_URL,'https://api.tropo.com/1.0/sessions?to=3213314633&msg=test4&token=010fc32265db5444bbf84e92bd28f1887395ce3ade6cf69e1424d586add66b17bdc7c1d8061803f1c2319d66');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,2);
$response = curl_exec($curl_handle);
$code = curl_getinfo($curl_handle,CURLINFO_HTTP_CODE);
//print $code;
//print $response;
print "SUCCESS";
curl_close($curl_handle);
?>
</body>
</html> 

 

 

sms app code:

 

 
<?php
message("".$msg,
array(
  "to" => "            +13213314633      ",
  "network" => "SMS"));
?>

 

 

 

Can you by any chance help me with my problem?

Link to comment
Share on other sites

xyph:

 

can you please pleas help me, I'm really new to this, could you write me the correct code? Please, or point where I'm making the mistake, it's saying line 10 but I can't see where is the mistake in there.

 

Anybody?

 

Please

 

Thank You

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.