phpcurlinmobi

inmobi API usage for session request


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


Solution

  • 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.