dsnrixf6765 2014-07-08 08:36
浏览 80
已采纳

用于会话请求的inmobi API用法

I have to develop an application to interact the inmobi API. I have try some code but got no response. Please help me how to use the API.

Its API docs URL is https://www.inmobi.com/support/art/23847616/22916893/advertiser-reporting-api-guide/

I am trying to create session for which I need to send the values in header. I have try the following code with post data and header as well but failed. did not get any output.

$request_header = array(
'Content-Type: application/json',
'userName: xxxxx',
'password: yyyyy',
'secretKey: zzzzz',
'accountId: iiiii',
);
$ch = curl_init('https://api.inmobi.com/v1.0/reporting/advertiser.json');
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER,  true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_header);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
print_r($response);print_r($info);

The response I get is:

Array
(
[url] => https://api.inmobi.com/v1.0/reporting/advertiser.json
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 2.348
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0
[redirect_time] => 0
)

If I have the problem with the way then please suggest some suitable method for it. Many Thanks

  • 写回答

1条回答 默认 最新

  • dqnqpqv3841 2014-07-10 02:50
    关注

    Just found out that their system can't be tested with localhost. I'd move the testing script to server and it works just fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况