I'm trying to set up two PHP on GAE sites: One to act as a web services layer, and another to act as the front-end. So far, things are great. I'm trying to secure communications between these two layers, so that not only I can call my web services.
I found this article that talks about making requests, and by doing so, it can set the X-Appengine-Inbound-Appid header, which is exactly what I want. https://developers.google.com/appengine/docs/php/urlfetch/#PHP_Making_requests
To do this, the article says I should "consider telling the UrlFetch service to not follow redirects when invoking it."; then promptly does not provide any documentation on how you actually DO that.
My request looks like this:
$data = ['data' => 'this', 'data2' => 'that'];
$data = http_build_query($data);
$context = [
'http' => [
'method' => 'get',
'header' => "custom-header: custom-value\r\n" . "custom-header-two: custome-value-2\r\n",
'content' => $data,
]
];
$context = stream_context_create($context);
$result = file_get_contents('urlgoeshere', false, $context);
Thoughts & help are appreciated!
Two ways, either set follow_location to false and/or max_redirects to 0.
or