大佬教程收集整理的这篇文章主要介绍了php – 致命错误:找不到类’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();
这些密钥只是替换为LikedIn Developers入门指南中的密钥.
预先感谢您的帮助.
> http://us3.php.net/manual/en/oauth.installation.php
> http://pecl.php.net/package/oauth
大多数服务器默认没有它,因为它实际上不是每个人都可能使用的东西.您可以要求您的主机安装它,或者如果您像我一样使用CGI,您可以在服务器上编译它.如果你运行PHPinfo();如果你有它,它会显示OAuth这个词,否则你就不会.
更新:使用https://github.com/Lusitanian/PHPoAuthLib而不是PECl.
以上是大佬教程为你收集整理的php – 致命错误:找不到类’OAuth’全部内容,希望文章能够帮你解决php – 致命错误:找不到类’OAuth’所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。