php - How do I display search results from URL query strings? -


i stumped on one. might simple not seeing it.

i have website working on need search external websites (only 1 now) files based on json query string , able return search results query on page (basically mini search engine).

example of how need connect (email received):

http://exampledomain.com/api/start_parcels_txn?client=t3vdwh&spatial_intersect=[wkt_geometry]

where [wkt_geometry] url-encoded ogc well-known text point or polygon geometry. spatial reference system spherical mercator used google , bing: epsg 3785 / 3857 / 900913.

the server response json-encoded object looks like, in case of success: {"status": "ok", "parcel_count": [number of matching parcels], "txn_id":"[transaction id string]"}

or in case of failure: {"status":"error","error_message":"[error message string]"}

for example, perform point query @ coordinate (-9663031.13, 3962292.03) falls in parcel @ 1400 university blvd, birmingham, al, form point string:

point(-9663031.13, 3962292.03)

then urlencode , pass "spatial_intersect" value: http://exampledomain.com/api/start_parcels_txn?client=t3vdwh&spatial_intersect=point(-9663031.13%203962292.03)

the response server is: {"status":"ok","parcel_count":1,"txn_id":"sadaoswk3dlfvcldefwu7p3sv"}

to perform rectangle query intersects previous parcel , 2 others, rectangle's lower-left coordinate: (-9663128.4741915, 3962254.4093738) , upper-right coordinate: (-9663033.5250705, 3962386.9798447) form polygon string: polygon((-9663128.4741915 3962254.4093738,-9663128.4741915 3962386.9798447,-9663033.5250705 3962386.9798447,-9663033.5250705 3962254.4093738,-9663128.4741915 3962254.4093738))

then urlencode , pass "spatial_intersect" value: http://exampledomain.com/api/start_parcels_txn?client=t3vdwh&spatial_intersect=polygon((-9663128.4741915%203962254.4093738,-9663128.4741915%203962386.9798447,-9663033.5250705%203962386.9798447,-9663033.5250705%203962254.4093738,-9663128.4741915%203962254.4093738)) response server is: {"status":"ok","parcel_count":3,"txn_id":"9skfh7pndzyjgxyagdnrxriwj"}

i want able have user input fields html form (like zip code, address, etc.), want able search on external website similar example above , display results in same page. having troubles finding online resources tackle , not of coder (more of systems admin) kind of stuck here. can understand code not sure how implement this.

this can done javascript, html, php, doesn't matter trying figure out easy , maybe example if exists. if has insights on appreciated!

this code have far (accessible @ http://s31tech.com/json). know still have ways go, if put in point(-9663031.13%203962292.03) spatial-intersect field, find valid response:

    <html>     <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8" />     <title>untitled document</title>     </head>      <body>      <form method="post" action="<?php echo $php_self;?>">     address:<input type="text" name="address">     spatial intersect: <input type="text" name="intersect">     <input type="submit">     </form>     <br />     address entered was: <?php echo $_post["address"]; ?>     <br />     spatial intersect coordinates: <?php echo $_post["intersect"]; ?>     <br />     <br />        <?php     $url = "http://reportallusa.com/api/start_parcels_txn?client=t3vdwh&";     $spatial_intersect = "spatial_intersect=";     //$coordinates = "point(-9663031.13%203962292.03)";     $coordinates = $_post["intersect"];;      $json = file_get_contents($url.$spatial_intersect.$coordinates);      // echo json (you can echo javascript use there)     echo $json;      // can decode process in php     $data = json_decode($json, true);     var_dump($data);     ?>     <br />     url path: <br />     <?php echo $json; ?>      </body>     </html> 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -