File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 17
17
// Author: Jenny Murphy - http://google.com/+JennyMurphy
18
18
19
19
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
+ }
20
26
21
27
// Always respond with a 200 right away and then terminate the connection to prevent notification
22
28
// retries. How this is done depends on your HTTP server configs. I'll try a few common techniques
48
54
require_once 'google-api-php-client/src/contrib/Google_MirrorService.php ' ;
49
55
require_once 'util.php ' ;
50
56
51
- if ($ _SERVER ['REQUEST_METHOD ' ] != "POST " ) {
52
- echo "method not supported " ;
53
- exit ();
54
- }
55
-
56
57
// Parse the request body
57
58
$ request_bytes = @file_get_contents ('php://input ' );
58
59
$ request = json_decode ($ request_bytes , true );
96
97
97
98
break ;
98
99
case 'locations ' :
99
- $ location = $ mirror_service ->locations ->get ("latest " );
100
+ $ location_id = $ request ['itemId ' ];
101
+ $ location = $ mirror_service ->locations ->get ($ location_id );
100
102
// Insert a new timeline card, with a copy of that photo attached
101
103
$ loc_timeline_item = new Google_TimelineItem ();
102
104
$ loc_timeline_item ->setText ("You are at " . $ location ->getLatitude () . " by " .
You can’t perform that action at this time.
0 commit comments