我正在尝试通过php curl与ooyala videoplaza api调用任何API,但它是返回我的登录页面。我有" x-o-api-key"键。我有指令链接是:link1,link2
php卷曲代码:
<?php
$method = "GET";
$data = "?x-o-api-key=myapikeyhere";
$request = "https://api.videoplaza.com/api/1.0/campaign?status=upcoming&state=enabled".$data;
$ch = curl_init($request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Length:50'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$output = curl_exec($ch);
print_r($output);
?>
我对PHP不太熟悉,但我认为您应该将x-o-api-key
作为标头字段发送(而不是作为数据发送到请求)。