PHP OAUTH类的API [英] PHP OAUTH class api

查看:183
本文介绍了PHP OAUTH类的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OAuth :: fetch()方法例如,在PHP.net( OUTH code 我用的是鳕鱼。

I am using OAuth::fetch() example in PHP.net (Outh code. The cod i use is

<?PHP
try{
$oauth = new OAuth("consumer_key","consumer_secret",OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setToken("access_token","access_token_secret");

$oauth->fetch("http://photos.example.net/photo?file=vacation.jpg");

$response_info = $oauth->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $oauth->getLastResponse();
} catch(OAuthException $E) {
 echo "Exception caught!\n";
}?>

该错误消息

致命错误:类'的OAuth用C未找到:\\ WAMP \\ WWW \\ Jesvin \\ MyTest1 \\ test1.php第3行

Fatal error: Class 'OAuth' not found in C:\wamp\www\Jesvin\MyTest1\test1.php on line 3

推荐答案

您没有可用使用OAuth的类。这是一个PHP扩展,而不是核心包的一部分,您将需要手动安装到WAMP。首先要做的就是检查扩展是否可用,但没有加载。

You do not have the OAuth class available to use. It is a php extension and not part of the core package, you will need to install it manually into wamp. First thing to do is check whether the extension is available but not loaded.

您的PHP扩展库将会像/路径/要/ WAMP / PHP /分机(我不使用WAMP所以你必须谷歌的路径,或在文件系统中寻找自己)。

Your php extension library will be something like /path/to/wamp/php/ext (i do not use wamp so you will have to google for your path or look for yourself in your filesystem).

如果你看到一个OAuth的扩展,可以跳过安装OAuth的,如果你没有,你需要获得一个precompiled DLL,请看这里:的 http://downloads.php.net/pierre/ 并为SEACHOAuth的,有2个(不知道你应该使用哪一个,所以挑选一个,如果它不工作尝试其他)。

If you see an oauth extension, you can skip installing oauth, if you do not you need to get a precompiled dll, look here: http://downloads.php.net/pierre/ and seach for "oauth", there are 2 (not sure which one you should use, so pick one, and if it doesnt work try the other).

下载它,并与德等PHP扩展一起坚持德DLL在您的扩展目录。

Download it and stick teh dll in your extensions directory along with teh other php extensions.

然后找到你的php.ini文件(可以使用与℃的文件;?PHP的phpinfo;&GT; 并加载它在浏览器中看到的PHP。 INI是)。发现那里的扩展定义,要么取消注释或该行添加到您的php.ini文件

Then find your php.ini file (you can use a file with <?php phpinfo; ?> and load it in your browser to see where php.ini is). Find where the extensions are defined and either uncomment or add this line to your php.ini file

扩展= p​​hp_oauth.dll

确保code中的DLL名称上面德一样的,你下载并安装到扩展文件夹的人。另外,还要确保有半在此行的开始结肠。

ensure the dll name in the code above is teh same as the one you downloaded and installed to the extension folder. Also make sure there is NO semi colon at the start of this line.

这应该只是做到这一点。希望PHP将加载DLL罚款,它会工作。使用pre-comiled DLL的并不总是有效的,但在这种情况下,将有希望的工作。

That should just about do it. Hopefully php will load the DLL fine and it will work. Using pre-comiled dll's doesn't always work, but in this instance it will hopefully work.

这篇关于PHP OAUTH类的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆