下面是我的控制器的一些代碼(別擔心,鍵是假的)。我使用ZendService \ Twitter \ Twitter模塊。幾乎一切工作只有最後一個錯誤是有點奇怪,我無法弄清楚:CURL致電Twitter API的SSL錯誤
Unable to enable crypto on TCP connection api.twitter.com: make sure the "sslcafile" or "sslcapath" option are properly set for the environment.
正如你可以看到我下面我的控制器的代碼,你可以看到,無論是驗證點的和主機設置爲false。該適配器已被設置爲Curl而不是HTTP。
<?php
namespace Twitter\Controller;
use QDCore\Controller\AbstractController;
use Zend\Mvc\MvcEvent;
use Zend\View\Model\JsonModel;
use ZendService\Twitter\Twitter;
class GetController extends AbstractController
{
protected $instance;
public function onDispatch(MvcEvent $e)
{
$config = array(
'access_token' => array(
'token' => '1024003resagsDQGyVC5YZ23423PpBNOwefS',
'secret' => 'oES8Jergewagewahsh2hTqrYGDJo',
),
'oauth_options' => array(
'consumerKey' => 'QY360Nersehr234gg4aV2pw',
'consumerSecret' => 'eEfgdagewa0Hkt4z6nCqHPY1M4wwuubY',
),
'username' => 'myusername',
'http_client_options' => array(
'adapter' => 'Zend\Http\Client\Adapter\Curl',
'curloptions' => array(
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
),
),
);
$this->instance = new Twitter($config);
return parent::onDispatch($e);
}
public function indexAction()
{
$result = new JsonModel(array('message' => 'No valid function call made'));
return $result;
}
public function usertimelineAction()
{
$options = array(
'user_id' => 'myaccountname',
'count' => 30,
);
$twitter = new Twitter($options);
$response = $twitter->statuses->userTimeline();
var_dump($response);
die;
return new JsonModel($response);
}
}
希望有人對如何解決它有一個想法。我的主域名不在SSL上運行,也不會。
感謝
相關http://stackoverflow.com/questions/16298282/php-and-ssl-ca-verification-os-independent – Xerkus