在没有 ssl 的情况下在本地测试 twitters php api


Test twitters php api locally without ssl

我正在尝试通过php让Twitter发布到我的墙上,我可以看到的唯一方法是首先进行身份验证,并且要获得它,我需要向Twitter询问:)Facebook做得更好;p

所以我正在使用 ricardoper/twitteroauth 来做到这一点,当试图获得 tockens,我从击中这里看到的卷曲文件中得到这个:https://github.com/ricardoper/TwitterOAuth/blob/v2/src/Common/Curl.php

不确定这是因为我在本地运行 php,还是与 Twitter 有关。

<br />
<b>Fatal error</b>:  Uncaught cURL Lib: [60] SSL certificate problem: unable to get local issuer certificate (TwitterOAuth'Exception'CurlException) 
  thrown in <b>C:'var'www'fbshare'TwitterOAuth'src'Common'Curl.php</b> on line <b>110</b><br />

我如何克服这个错误,或者能够发布到推特,但我相信这个脚本可以做到这一点。

事实证明,我使用的存储库pem不支持本地主机上的 ssl。

我从这里下载本地ssl证书

将第 64 行替换为CURLOPT_CAINFO => '/var/www/cacert.pem',,这是从上面给出的链接下载的pem,现在我可以在本地访问 ssl :)