我正在尝试连接 LinkedIn API,但每次访问时都会出现以下错误:
致命错误:在 /home/vhosts/*/test.php 的第8行找不到类“OAuth”
我正在使用000WebHost上的免费服务器,并且我已经阅读了免费服务器有时不支持OAuth的信息。我已经在另一台免费服务器上尝试了它,但是仍然收到相同的错误消息,所以我的问题是如何检查该服务器是否支持使用OAuth?
这是我的代码:
// Fill the keys and secrets you retrieved after registering your app
$oauth = new OAuth("abcd123456", "efgh987654");
$oauth->setToken("abcd1234-efgh987-9988", "9876abcd-123asdf-1122");
$params = array();
$headers = array();
$method = OAUTH_HTTP_METHOD_GET;
// Specify LinkedIn API endpoint to retrieve your own profile
$url = "http://api.linkedin.com/v1/people/~";
// By default, the LinkedIn API responses are in XML format. If you prefer JSON, simply specify the format in your call
// $url = "http://api.linkedin.com/v1/people/~?format=json";
// Make call to LinkedIn to retrieve your own profile
$oauth->fetch($url, $params, $method, $headers);
echo $oauth->getLastResponse();
这些键只是被LinkedIn开发者入门指南上的键所替换。
提前感谢您的帮助。