Derokorian;11045721 wrote:Request headers are in $SERVER.
I don't think they are. I had a function:
public function hook() {
file_put_contents("/tmp/_POST", serialize($_POST));
file_put_contents("/tmp/_SERVER", serialize($_ENV));
file_put_contents("/tmp/raw_post_input", file_get_contents('php://input'));
} // hook()
the contents of _SERVER was simply this:
a:0:{}
But the request that was sent from github was this:
Request URL: http://example.com/git/hook
Request method: POST
content-type: application/json
Expect:
User-Agent: GitHub-Hookshot/2d21501
X-GitHub-Delivery: 57d20c00-c2da-11e4-9902-532bc1f9529d
X-GitHub-Event: ping
X-Hub-Signature: sha1=74ebc28a4a3e1b6e06f059c27f12a75d2d9ec727
{
"zen": "Responsive is better than fast.",
"hook_id": 1234567,
"hook": {
"url": "https://api.github.com/repos/someuser/test/hooks/1234567",
"test_url": "https://api.github.com/repos/someuser/test/hooks/1234567/test",
"ping_url": "https://api.github.com/repos/someuser/test/hooks/1234567/pings",
"id": 1234567,
"name": "web",
"active": true,
"events": [
"push"
],
"config": {
"url": "http://example.com/git/hook",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"last_response": {
"code": null,
"status": "unused",
"message": null
},
"updated_at": "2015-03-05T01:52:56Z",
"created_at": "2015-03-05T01:52:56Z"
},
"repository": {
"id": 31684148,
"name": "test",
"full_name": "someuser/test",
"owner": {
"login": "someuser",
"id": 7654321,
"avatar_url": "https://avatars.githubusercontent.com/u/7654321?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/someuser",
"html_url": "https://github.com/someuser",
"followers_url": "https://api.github.com/users/someuser/followers",
"following_url": "https://api.github.com/users/someuser/following{/other_user}",
"gists_url": "https://api.github.com/users/someuser/gists{/gist_id}",
"starred_url": "https://api.github.com/users/someuser/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/someuser/subscriptions",
"organizations_url": "https://api.github.com/users/someuser/orgs",
"repos_url": "https://api.github.com/users/someuser/repos",
"events_url": "https://api.github.com/users/someuser/events{/privacy}",
"received_events_url": "https://api.github.com/users/someuser/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/someuser/test",
"description": "trying to test github deployment on push",
"fork": false,
"url": "https://api.github.com/repos/someuser/test",
"forks_url": "https://api.github.com/repos/someuser/test/forks",
"keys_url": "https://api.github.com/repos/someuser/test/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/someuser/test/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/someuser/test/teams",
"hooks_url": "https://api.github.com/repos/someuser/test/hooks",
"issue_events_url": "https://api.github.com/repos/someuser/test/issues/events{/number}",
"events_url": "https://api.github.com/repos/someuser/test/events",
"assignees_url": "https://api.github.com/repos/someuser/test/assignees{/user}",
"branches_url": "https://api.github.com/repos/someuser/test/branches{/branch}",
"tags_url": "https://api.github.com/repos/someuser/test/tags",
"blobs_url": "https://api.github.com/repos/someuser/test/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/someuser/test/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/someuser/test/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/someuser/test/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/someuser/test/statuses/{sha}",
"languages_url": "https://api.github.com/repos/someuser/test/languages",
"stargazers_url": "https://api.github.com/repos/someuser/test/stargazers",
"contributors_url": "https://api.github.com/repos/someuser/test/contributors",
"subscribers_url": "https://api.github.com/repos/someuser/test/subscribers",
"subscription_url": "https://api.github.com/repos/someuser/test/subscription",
"commits_url": "https://api.github.com/repos/someuser/test/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/someuser/test/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/someuser/test/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/someuser/test/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/someuser/test/contents/{+path}",
"compare_url": "https://api.github.com/repos/someuser/test/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/someuser/test/merges",
"archive_url": "https://api.github.com/repos/someuser/test/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/someuser/test/downloads",
"issues_url": "https://api.github.com/repos/someuser/test/issues{/number}",
"pulls_url": "https://api.github.com/repos/someuser/test/pulls{/number}",
"milestones_url": "https://api.github.com/repos/someuser/test/milestones{/number}",
"notifications_url": "https://api.github.com/repos/someuser/test/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/someuser/test/labels{/name}",
"releases_url": "https://api.github.com/repos/someuser/test/releases{/id}",
"created_at": "2015-03-04T22:50:29Z",
"updated_at": "2015-03-04T22:50:29Z",
"pushed_at": "2015-03-04T22:50:30Z",
"git_url": "git://github.com/someuser/test.git",
"ssh_url": "git@github.com:someuser/test.git",
"clone_url": "https://github.com/someuser/test.git",
"svn_url": "https://github.com/someuser/test",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"open_issues_count": 0,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master"
},
"sender": {
"login": "someuser",
"id": 7654321,
"avatar_url": "https://avatars.githubusercontent.com/u/7654321?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/someuser",
"html_url": "https://github.com/someuser",
"followers_url": "https://api.github.com/users/someuser/followers",
"following_url": "https://api.github.com/users/someuser/following{/other_user}",
"gists_url": "https://api.github.com/users/someuser/gists{/gist_id}",
"starred_url": "https://api.github.com/users/someuser/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/someuser/subscriptions",
"organizations_url": "https://api.github.com/users/someuser/orgs",
"repos_url": "https://api.github.com/users/someuser/repos",
"events_url": "https://api.github.com/users/someuser/events{/privacy}",
"received_events_url": "https://api.github.com/users/someuser/received_events",
"type": "User",
"site_admin": false
}
}