Access-Control-Allow-Origin' header to allow pulling this data into other domains.

This commit is contained in:
Michael Stenta 2018-11-06 10:24:48 -05:00
parent 591d07b09b
commit 04f6d03d34
1 changed files with 8 additions and 0 deletions

View File

@ -143,6 +143,14 @@ function farm_sensor_listener_page_callback($public_key) {
// If this is a GET request, retrieve sensor data.
elseif ($_SERVER['REQUEST_METHOD'] == 'GET') {
// Add 'Access-Control-Allow-Origin' header to allow pulling this data into
// other domains.
/**
* @todo
* Move this to a more official place, or adopt the CORS module in farmOS.
*/
drupal_add_http_header('Access-Control-Allow-Origin', '*');
// If the 'name' parameter is set, filter by name.
$name = '';
if (!empty($params['name'])) {