Problem in retrieving datetime parameter from url
iam passing some parameters in url to a page through curl, but to my surprise, iam开发者_JAVA百科 not able to retrieve all of the parameters.
This is an example of my url:
http://localhost/a.php?include=true&F1=2011-01-23 12:20:00&F2=2011-01-25 01:00:00
But in my "a.php" page, when i printed:
$_SERVER["REQUEST_URI"]
iam getting it like this: a.php?include=true&F1=2011-01-23
iam not getting full F1 parameter, and F2 parameter is not coming at all. I hope it is the problem with the space in the datetime parameters. If so, how to accomplish this?
Note that i cant change the datetime value as part of url, like i cant use timestamp instead of that.
Propobly it space problem. In url's space is encoded as '+'. Can you use urlencode in your curl script like this:
$url = "http://localhost/a.php?include=true&F1=".urlencode("2011-01-23 12:20:00")."&F2=".urlencode("2011-01-25 01:00:00");
It might worth to try to urlencode
the $_GET
properly
$arr =
array
(
'include'=>'true',
'F1'=>'2011-01-23 12:20:00',
'F2'=>'2011-01-25 01:00:00'
);
$url = 'http://localhost/a.php?'.http_build_query($arr);
精彩评论