hcgcloud / pterodactyl-sdk

Pterodactyl Panel PHP SDK/API wrapper
https://hcgcloud.github.io/pterodactyl-sdk-docs/
MIT License
27 stars 25 forks source link

Site not found #9

Closed adnanafzal565 closed 4 years ago

adnanafzal565 commented 4 years ago

Hi.

I am sending request to this address: "https://pterodactyl.app/api/application/users" and I am receiving "site not found" error. Even in browser.

tyson239 commented 4 years ago

Hi, which function are you using with this sdk?

adnanafzal565 commented 4 years ago

Thanks for quick reply. I am trying to get a list of all users on my panel, below is a CURL PHP function that I am trying to execute. Let me know if I am calling it correctly:

$pterodactyl = new \HCGCloud\Pterodactyl\Pterodactyl($api_key, $server_address);

$curl = curl_init();

curl_setopt_array($curl, array( CURLOPT_URL => "api/application/users", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( "Authorization: Bearer meowmeowmeow", "Content-Type: application/json", "Accept: Application/vnd.pterodactyl.v1+json" ) ));

$response = curl_exec($curl); curl_close($curl);

print_r($response);

adnanafzal565 commented 4 years ago

The issue was in CURLOPT_URL, I had to give complete URL including IP address.

CURLOPT_URL => "http://45.142.115.1/api/application/users",

Thanks.

tyson239 commented 4 years ago

you can call the functions of this sdk, using curl to make requests directly is not necessary.

adnanafzal565 commented 4 years ago

Yes, it was the problem in URL. It has been fixed.

Thank you for your qiuck and helpful reply.