rdugan / iceriver-oc

Modified firmware for IceRiver ASICs, adding overclocking and other goodies
113 stars 4 forks source link

API use from PHP #78

Closed mactoolz closed 2 months ago

mactoolz commented 2 months ago

Hello,

i use PHP to use the API interface. Every time iam at the HTTP ErrorCode 404.

Do you have some tipps to solve my problem.

That is my API Request as curl config.

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Bei selbstsignierten Zertifikaten curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Folgt Umleitungen automatisch curl_setopt($ch, CURLOPT_HTTPHEADER, array(Authorization: Bearer ' . API_TOKEN // API-Token für die Authentifizierung

rdugan commented 2 months ago

I would need to see the URL :)

mactoolz commented 2 months ago

This is my URL oc curl ...

https://172.16.210.8:443/api/v1/overview http://172.16.210.8:4111/api/v1/overview http://172.16.210.8/api/v1/overview

all of them is not wokring

rdugan commented 2 months ago

there's no /v1 in the endpoints. and it's https - with or without :443 - doesn't matter

mactoolz commented 2 months ago

ok, and what is the authentication mode ?

rdugan commented 2 months ago

you've already included the authentication in the HTTP Authorization header

mactoolz commented 2 months ago

` /**

mactoolz commented 2 months ago

and now ????

rdugan commented 2 months ago

404 means the url is wrong, as i explained above. your auth header in the original post looks correct, which i've also already stated. i can't debug your php for you.

I'm not sure what your question is. here's an example curl request:

curl -k -H "Authorization: Bearer 5b281acc-de86-41bb-b14d-e266d9c9edbd" https://ks0ultra-0/api/overview

mactoolz commented 2 months ago

Ok, thank you, i test it again.

I see it is a Bearer token, not only Token that is importent.

mactoolz commented 2 months ago

it is not possible for me to connect from PHP to our firmware. But if use curl at the windows console, it is working !!!

mactoolz commented 2 months ago

now it works ... i have set some curl options, but i dont know what was wrong. i test it ...

`// ########################################################################################################################################### /**