'pjson', 'searchExtent' => '{"xmin":-0.5,"ymin":49.732307856286,"xmax":-1.97117692088061,"ymax":48.4,"spatialReference":{"wkid":84}}', 'text' => $_GET['text'] ); //url-ify the data for the POST $url_data = http_build_query($data); $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $url_data); // $fp = fopen(dirname(__FILE__).'/suggest.log', 'w'); // curl_setopt($ch, CURLOPT_VERBOSE, 1); // curl_setopt($ch, CURLOPT_STDERR, $fp); //So that curl_exec returns the contents of the cURL; rather than echoing it curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); //execute post $result = curl_exec($ch); echo $result; } if(isset($_GET['address'])|isset($_GET['magicKey'])) { $url = 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find'; $data = array('f' => 'pjson', 'searchExtent' => '{"xmin":-0.5,"ymin":49.732307856286,"xmax":-1.97117692088061,"ymax":48.4,"spatialReference":{"wkid":84}}', 'magicKey' => $_GET['magicKey'], 'text' => $_GET['address'] ); //url-ify the data for the POST $url_data = http_build_query($data); // var_dump($url_data); $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $url_data); // $fp = fopen(dirname(__FILE__).'/find.log', 'w'); // curl_setopt($ch, CURLOPT_VERBOSE, 1); // curl_setopt($ch, CURLOPT_STDERR, $fp); //So that curl_exec returns the contents of the cURL; rather than echoing it curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); //execute post $result = curl_exec($ch); echo $result; } ?>