-
-
Save anonymous/cf83e6d04f84c49ca826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$auth_code = $_GET["access_token"]; | |
print_r(curl_post("https://crest-tq.eveonline.com/characters/92439100/contacts/",$auth_code)); | |
print_r(curl_get("https://crest-tq.eveonline.com/characters/92439100/contacts/",$auth_code)); | |
function curl_post($url,$auth_code) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
// Set so curl_exec returns the result instead of outputting it. | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
// Does not verify peer | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
// Get the response and close the channel. | |
$headers = array( | |
"Authorization: Bearer ".$auth_code, | |
); | |
// auth header | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
// Post options, for get comment out | |
curl_setopt($ch, CURLOPT_POST, 1); | |
$post["standing"] = 10; | |
$post["contactType"] = "Alliance"; | |
$post["contact"] = array(); | |
$post["contact"]["id_str"] = "386292982"; | |
$post["contact"]["href"] = "https://public-crest.eveonline.com/alliances/386292982/"; | |
$post["contact"]["name"] = "Pandemic Legion"; | |
$post["contact"]["id"] = 386292982; | |
print_r($post); | |
$post = json_encode($post,JSON_UNESCAPED_UNICODE); | |
print_r($post); | |
//$post = '{ "standing": 10, "contactType": "Alliance" "contact": { "id_str": "386292982", "href": "http://crest.regner.dev/alliances/386292982/", "name": "Pandemic Legion", "id": 386292982 }, }'; | |
//$post = '{"standing":10,"contactType":"Alliance","contact":{"id_str":"1147488332","href":"https://public-crest.eveonline.com/alliances/1147488332/","name":"The Kadeshi","id":1147488332}}'; | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
$response = json_decode($response); | |
return $response; | |
} | |
function curl_get($url,$auth_code) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
// Set so curl_exec returns the result instead of outputting it. | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
// Does not verify peer | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
// Get the response and close the channel. | |
$headers = array( | |
"Authorization: Bearer ".$auth_code, | |
); | |
// auth header | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
//print_r($ch); | |
$response = curl_exec($ch); | |
//print_r($response); | |
curl_close($ch); | |
$response = json_decode($response); | |
return $response; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment