Skip to content

Commit d3caf0e

Browse files
committed
responded to Alain's pull request comments
1 parent 68ecbbd commit d3caf0e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

notify.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
// Author: Jenny Murphy - http://google.com/+JennyMurphy
1818

1919

20+
// Only process POST requests
21+
if ($_SERVER['REQUEST_METHOD'] != "POST") {
22+
header("HTTP/1.0 405 Method not supported");
23+
echo("Method not supported");
24+
exit();
25+
}
2026

2127
// Always respond with a 200 right away and then terminate the connection to prevent notification
2228
// retries. How this is done depends on your HTTP server configs. I'll try a few common techniques
@@ -48,11 +54,6 @@
4854
require_once 'google-api-php-client/src/contrib/Google_MirrorService.php';
4955
require_once 'util.php';
5056

51-
if ($_SERVER['REQUEST_METHOD'] != "POST") {
52-
echo "method not supported";
53-
exit();
54-
}
55-
5657
// Parse the request body
5758
$request_bytes = @file_get_contents('php://input');
5859
$request = json_decode($request_bytes, true);
@@ -96,7 +97,8 @@
9697

9798
break;
9899
case 'locations':
99-
$location = $mirror_service->locations->get("latest");
100+
$location_id = $request['itemId'];
101+
$location = $mirror_service->locations->get($location_id);
100102
// Insert a new timeline card, with a copy of that photo attached
101103
$loc_timeline_item = new Google_TimelineItem();
102104
$loc_timeline_item->setText("You are at " . $location->getLatitude() . " by " .

0 commit comments

Comments
 (0)