Acceder a api.adoptaunaplaya.es desde Drupal
Con este código podréis acceder desde PHP/Drupal a la api que el equipo de @47deg_es prepararon para el Hackaton Opendata Sevilla.
Más info en http://api.adoptaunaplaya.es/
<?php
$payload = array(
'offset' => 0,
'limit' => 10,
'query' => 'select p.adoptadaPor, count(p) from Playa p group by p.adoptadaPor order by count(p) desc',
'properties' => array('usuario', 'totalPlayas'),
);
$options = array(
'method' => 'POST',
'headers' => array(
'Content-Type' => 'application/json',
),
'data' => drupal_json_encode($payload),
);
$response = drupal_http_request('http://api.adoptaunaplaya.es/api/playas/query', $options);
if ($response->code == 200) {
$results = drupal_json_decode($response->data);
}
?>
Written by Pedro Lozano
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#