Reputation: 15
I have an external php file which i send a parameters to it like the following : http://www.smsws.com/sendsms.php?user=demo&password=demo&numbers=973390000000&sender=hgicom.com&message=test&lang=en
when i go to that link it will show a message if the login is invalid or the number is incorrect, ..etc i want to know how to get that message, because based on this message i will do an action in my application. is that possible?
Upvotes: 0
Views: 176
Reputation: 2540
$url="http://www.smsws.com/sendsms.php?user=demo&password=demo&numbers=973390000000&sender=hgicom.com&message=test&lang=en"
$res=file_get_contents($url);
if($res)
{
echo "message successfully send";
}
Upvotes: 1
Reputation: 2452
$msgurl='http://www.smsws.com/sendsms.php?user=demo&password=demo&numbers=973390000000&sender=hgicom.com&message=test&lang=en;
$result=file_get_contents($msgUrl);
switch($result) {
case 'successful':
echo ' awesome';
break;
}
you may use if statements as well depending on the input sent back
Upvotes: 1
Reputation: 3288
You will need to use cURL to fetch page, and some html parser like http://simplehtmldom.sourceforge.net/ to parse response.
There are plenty of resources how to work with cURL, here is basic one http://www.higherpass.com/php/Tutorials/Using-Curl-To-Query-Remote-Servers/
Upvotes: 0