Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getCharacterIdFromName($name){
- //curl -X POST "https://esi.evetech.net/latest/universe/ids/" -H "accept: application/json" -H "Accept-Language: en-us" -H "Content-Type: application/json" -d "[ \"Jehle\"]"
- //The url you wish to send the POST request to
- $url = "https://esi.evetech.net/latest/universe/ids/";
- //The data you want to send via POST
- $fields = array("names" => "Jehle") ;
- print_r($fields);
- //url-ify the data for the POST
- $fields_string = http_build_query($fields);
- //open connection
- $ch = curl_init();
- //set the url, number of POST vars, POST data
- curl_setopt($ch,CURLOPT_URL, $url);
- curl_setopt($ch,CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Accept-Language: en-us'
- ));
- curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
- // Receive server response ...
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $server_output = curl_exec($ch);
- $server_output = json_decode($server_output, true);
- print_r($server_output);
- curl_close ($ch);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement