Last active
December 18, 2015 05:09
-
-
Save rfmeier/5730139 to your computer and use it in GitHub Desktop.
Retrieve a query count from an ArcGIS Server request.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// create the query | |
$query = array( | |
'f' => 'json', // return json | |
'returnCountOnly' => 'true', // return county only | |
'where' => "OWNERNME1 LIKE '%sm%' OR OWNERNME2 LIKE '%sm%'", // the where clause | |
); | |
// query url - TaxParcel/TaxParcelQuery service - TaxParcelPublishing layer | |
$url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/TaxParcelQuery/MapServer/0/query'; | |
// execute the remote call | |
$remote_response = wp_remote_post( $url, array( | |
'body' => $query | |
)); | |
// check for a WP_Error object, if so, return it | |
if( is_wp_error( $remote_response ) ) | |
return $remote_response; | |
// grab the reponse body as a JSON string | |
$response_body = wp_remote_retrieve_body($remote_response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment