2016-12-15 53 views
1

我想通过php curl创建连接或通过ooyala videoplaza api调用任何api,但它返回我的登录页面。 我有“x-o-api-key”键。 我参考,链接是:link1link2无法与ooyala videoplaza api创建连接

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); 

?> 

回答

0

我不太熟悉PHP,但我认为你应该发送x-o-api-key为标题字段(而不是作为请求的数据)。