2

I have a form that sends a SMS via Clickatell in accordance to their HTTP api

<form action="http://api.clickatell.com/http/sendmsg" method="get">

This works, But I need to save the SMS I send to my SQL as well. I know to send I need to use method="post"

But then this will not get the number and text I want to send and send it.

How can I make it that it gets the info from the form and also post it to the SQL.

Presuming the form is 1.php and the submit to sql is 2.php

Maggie Ackermann
  • 253
  • 1
  • 4
  • 15
  • it seems the problem would be that your action is at `clickatell.com` and not the method - this form wouldn't go to your server at all. – Nick Andriopoulos May 01 '13 at 07:47

3 Answers3

6

You could make the form post all of the data, and save your text in a database, then do a cURL call to the clickatell API afterwards. Google cURL get_page function for example on how to use cURL to load a page

Daniel Mensing
  • 956
  • 5
  • 13
  • or use `file_get_contents()` http://uk3.php.net/manual/en/function.file-get-contents.php – Waygood May 01 '13 at 07:48
  • 2
    +1 This would also have the advantage of not needing to put your [Clickatell API login/password](http://www.clickatell.com/apis-scripts/apis/http-s/) in the web page which is probably the case now. – Joachim Isaksson May 01 '13 at 07:49
0

I think you can use $_GET['variable_name']; in your 2.php

You can check form documentation here http://www.w3schools.com/php/php_get.asp

Fabio
  • 23,183
  • 12
  • 55
  • 64
0

Use can use CURL function for more detail.. http://php.net/manual/en/curl.examples.php

and store $result in database,$result is an array so use (foreach) loop for fetch data and it also provide a response of ur api is success or fail.

Rajendra Yadav
  • 645
  • 3
  • 12