Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RoyGoode's avatar

how to make a GET Request for api

Need to make a get request to api to return the specified video that contains :

AUTHORIZATIONS:
api_key
PATH PARAMETERS
video
required
string
The Id of video

QUERY PARAMETERS
secure_ip	
string
The IP address for generate secure links for. If channel is secure default is request IP

secure_expire_time	
integer
The Unix Timestamp for expire secure links. * If channel is secure default is 24 hours later from now

Responses
200 Return the specific video

i try this :

  public function play()
    {
        return Http::withHeaders([
            'X-Apikey(this name from the API doc)' => '*************-*****-****-************',
        ])->get('https://api.xcloud.com/videos/'.$this->url, [
            'secure_ip' => \request()->ip(),
            'secure_expire_time' => strtotime("+2 hours")
        ]);
    }

//error : 
{"message":"Unauthenticated."}
0 likes
1 reply
tykus's avatar

Unauthenticated suggests your api key or your means of authenticating are incorrect.

1 like

Please or to participate in this conversation.