I am sending SMS from my bus ticketing site. The SMS can be send as follows :
header('Location: http://alerts.icisms.in/api/web2sms.php?workingkey=XXXXXX&sender=ABCD&to='.$number.'&message='.$message);
But I need to return to my own site.How can I accomplish this?
Use cURL or a simple file()/file_get_contents() call.
//call
$url = 'http://alerts.icisms.in/api/web2sms.php?workingkey=XXXXXX&sender=ABCD&to=' . $number . '&message=' . $message;
//do call
file($url);
Then set your header location to your site.
You make an HTTP request using PHP (e.g. with the cURL library or fopen).
You don't give your key to the user and ask their browser to make the request to the API.
From the looks of it you would just be able to do a simple request to this page.
You can achieve this using either the CURL functions or simply using file_get_contents to perform a single GET request.
By using header
you're redirecting the client which is unnecessary and potentially unsecure. EDIT: Scrap potentially, you've got an authentication key in there so giving that to your third-party users is not a good thing to do at all.