Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.1

Request #18108 Replace $_GET with $_REQUEST so that POST forms can also work.
Submitted: 2010-12-09 10:13 UTC
From: aiham Assigned:
Status: Open Package: Net_UserAgent_Mobile_GPS (version 0.1.1)
PHP Version: 5.1.6 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2010-12-09 10:13 UTC] aiham (Aiham Hammami)
Description: ------------ Hello, I think it would be useful if you used the $_REQUEST variable rather than $_GET for accessing the GPS position. With this change, you will be able to use POST forms. I've tested POST forms with Docomo, Softbank and AU phones. The Docomo and Softbank phones both sent the data by POST, resulting in getGPSResponse() returning an array with empty values. AU always sent the GPS position by GET (whether or not the form was post) so there was no problem with it. The following are lines that I think should be changed: Docomo.php:122: $_lat = $_GET['lat']; Docomo.php:123: $_lon = $_GET['lon']; Ezweb.php:114: $_lat = $_GET['lat']; Ezweb.php:115: $_lon = $_GET['lon']; Softbank.php:125: $pos = $_GET['pos']; Willcom.php:114: $_lat = $_GET['lat']; Willcom.php:115: $_lon = $_GET['lon']; It would be appreciated if you could make this change. Regards, Aiham Test script: --------------- /* page1.php */ $gps = Net_UserAgent_Mobile_GPS::factory(); $gps_link = $gps->getGPSLink('http://www.example.com/page2.php', 'Text'); echo '<form method="post" action="'.$gps_link['url'].'" lcs z><input type="submit" /></form>'; /* page2.php */ $gps = Net_UserAgent_Mobile_GPS::factory(); $location = $gps->getGPSResponse(); var_dump($_POST); var_dump($_GET); var_dump($location); Expected result: ---------------- ============= SoftBank ============= $_POST: array(3) { ["pos"]=> string(27) "N35.40.28.722E139.40.27.825" ["geo"]=> string(5) "wgs84" ["x-acr"]=> string(1) "1" } ---- $_GET: array(0) { } ---- $location: array(2) { ["lat"]=> string(12) "35.40.28.722" ["lon"]=> string(13) "139.40.27.825" } ============= AU ============= $_POST: array(0) { } ---- $_GET: array(12) { ["ver"]=> string(1) "1" ["datum"]=> string(1) "0" ["unit"]=> string(1) "0" ["lat"]=> string(12) "+35.40.37.59" ["lon"]=> string(13) "+139.40.27.63" ["alt"]=> string(5) "32767" ["time"]=> string(14) "20101209125055" ["smaj"]=> string(3) "121" ["smin"]=> string(2) "95" ["vert"]=> string(5) "65535" ["majaa"]=> string(3) "156" ["fm"]=> string(1) "1" } ---- $location: array(2) { ["lat"]=> string(12) "+35.40.37.59" ["lon"]=> string(13) "+139.40.27.63" } ============= Docomo ============= $_POST: array(5) { ["lat"]=> string(13) "+35.40.34.944" ["lon"]=> string(14) "+139.40.34.805" ["geo"]=> string(5) "wgs84" ["alt"]=> string(7) "+74.000" ["x-acc"]=> string(1) "2" } ---- $_GET: array(0) { } ---- $location: array(2) { ["lat"]=> string(13) "+35.40.34.982" ["lon"]=> string(14) "+139.40.25.999" } Actual result: -------------- ============= SoftBank ============= $_POST: array(3) { ["pos"]=> string(27) "N35.40.28.722E139.40.27.825" ["geo"]=> string(5) "wgs84" ["x-acr"]=> string(1) "1" } ---- $_GET: array(0) { } ---- $location: array(2) { ["lat"]=> bool(false) ["lon"]=> bool(false) } ============= AU ============= $_POST: array(0) { } ---- $_GET: array(12) { ["ver"]=> string(1) "1" ["datum"]=> string(1) "0" ["unit"]=> string(1) "0" ["lat"]=> string(12) "+35.40.37.59" ["lon"]=> string(13) "+139.40.27.63" ["alt"]=> string(5) "32767" ["time"]=> string(14) "20101209125055" ["smaj"]=> string(3) "121" ["smin"]=> string(2) "95" ["vert"]=> string(5) "65535" ["majaa"]=> string(3) "156" ["fm"]=> string(1) "1" } ---- $location: array(2) { ["lat"]=> string(12) "+35.40.37.59" ["lon"]=> string(13) "+139.40.27.63" } ============= Docomo ============= $_POST: array(5) { ["lat"]=> string(13) "+35.40.34.944" ["lon"]=> string(14) "+139.40.34.805" ["geo"]=> string(5) "wgs84" ["alt"]=> string(7) "+74.000" ["x-acc"]=> string(1) "2" } ---- $_GET: array(0) { } ---- $location: array(2) { ["lat"]=> NULL ["lon"]=> NULL }

Comments