Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Created June 7, 2013 15:39
Show Gist options
  • Save rfmeier/5730208 to your computer and use it in GitHub Desktop.
Save rfmeier/5730208 to your computer and use it in GitHub Desktop.
Retrieve a query ID set from an ArcGIS Server request.
<?php
// create the query
$query = array(
'f' => 'json', // return json
'returnIdsOnly' => 'true', // return id set 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