0

我想知道为什么我没有得到任何回应。我已经在 xampp 中的 php 中取消了 php.ini 中的 curl 注释。(我发现其他帖子我也应该取消注释 apache 和 php4 文件夹中 php.ini 的 curl 部分,但只有 1 个 php.ini,它位于 php dir 中)。

同样在我取消注释 curl 部分之前,浏览器会给出无法识别的功能错误。在我取消注释后,它还可以,所以我想这部分还可以。

<?php

$whmusername = "my_email";
$whmpassword = "my_password";

$query = "https://api.appannie.com/v1/accounts";

$ch = curl_init();
// Sets the URL cURL will open
curl_setopt($ch, CURLOPT_URL, $query);
// Here's the HTTP auth
// The 3rd argument is your Twitter username and password joined with a colon
curl_setopt($ch, CURLOPT_USERPWD, $whmusername." : ".$whmpassword);
// Makes curl_exec() return server response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// And here's the result JSON
$response = curl_exec($ch);
curl_close($ch);

echo 'Code line went here 1,';

print $response;
echo $response;

echo 'Code line successful here too';
?>

然后我在浏览器中得到的只是:代码行在这里 1,代码行在这里也成功

没有反应?还是我忘记了什么。我希望能够看到响应或 json 格式?

这是他们的 api 的链接:http: //support.appannie.com/entries/23224038-1-Quick-Start http://support.appannie.com/categories/20082753-Analytics-API

还。我从这里得到了这个代码: Appannie api basic authentication

请问其他人可以试试这些吗?

4

0 回答 0