· 4 years ago · Nov 26, 2020, 04:30 AM
1<?php
2
3$apikey = "";
4$secretkey = "";
5$url = "http://chapi.tauri.hu/apiIndex.php?apikey=" . $apikey;
6
7$data = array(
8 "secret" => $secretkey,
9 "url" => "character-sheet", //character-pvp-stat
10 "params" => array(
11 "r" => "[HU] Tauri WoW Server",
12 "n" => "Søntii"
13 )
14
15);
16
17$url_send = $url;
18$str_data = json_encode($data);
19
20function sendPostData($url, $post){
21 $ch = curl_init($url);
22 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
23 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
24 curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
25 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
26 $result = curl_exec($ch);
27 curl_close($ch);
28 return $result;
29}
30
31print_r(sendPostData($url_send, $str_data));
32
33?>
34