I have a url :
http://localhost:17080/SMSService/Getsms.php?to=100001&body=6260575535299&from=09350000008
and I want to get the value of "to" , "body" , "from" . how can I do this in php? Thanks a lot
I have a url :
http://localhost:17080/SMSService/Getsms.php?to=100001&body=6260575535299&from=09350000008
and I want to get the value of "to" , "body" , "from" . how can I do this in php? Thanks a lot
you can try the below..
<?php
echo $_GET['to'];
echo $_GET['body'];
echo $_GET['from'];
?>
I'm not sure, but maybe OP wants just to parse an url. It could be something like this then:
#!/usr/bin/php
<?php
$url = "http://localhost:17080/SMSService/Getsms.aspx?to=100001&body=6260575535299&from=09350000008";
$url_parts = parse_url($url);
parse_str($url_parts['query'], $path_parts);
echo($path_parts['to']."\n");
echo($path_parts['body']."\n");
echo($path_parts['from']."\n");
?>
and output is:
100001
6260575535299
09350000008
Use the $_GET
superglobal:
if (array_key_exists('body', $_GET))
echo $_GET['body'];
But this is really simple stuff. The beginners tutorial in the Getting Started section on PHP.net already covers superglobals (although they start with $_SERVER rather than $_GET). If you desire to learn PHP quickly, it will pay to read a couple of those before asking questions like this.
It is really simple.
<?php
$to = $_GET['to'];
$from = $_GET['from'];
......// and so on...
?>
For this to work, you need to store it in a php file. Read more about this : http://www.php.net/manual/en/reserved.variables.get.php