jublo / codebird-php

Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.
https://www.jublo.net/projects/codebird/php
GNU General Public License v3.0
777 stars 235 forks source link

Unknown SSL protocol error in connection to api.twitter.com:443 #174

Closed properties closed 7 years ago

properties commented 8 years ago

Hello,

I am adding accounts to my twitter API, and everything is working fine but sometimes it fails to add the account. I add about 20 accounts successful, then it sometimes gives this error 1-2 times and then go again. What is not right?


<br />
<b>Fatal error</b>:  Uncaught exception 'Exception' with message 'Request error for API call: Unknown SSL protocol error in connection to api.twitter.com:443 ' in /fullpath/Codebird.php:2062
Stack trace:
#0 /fullpath/Codebird.php(2014): Codebird\Codebird-&gt;_callApiCurl('POST', 'oauth/request_t...', 'oauth/request_t...', Array, false, false)
#1 /fullpath/Codebird.php(836): Codebird\Codebird-&gt;_callApi('POST', 'oauth/request_t...', 'oauth/request_t...', Array, false, false)
#2 /fullpath/requestUrl.php(37): Codebird\Codebird-&gt;__call('oauth_requestTo...', Array)
#3 /fullpath/requestUrl.php(37): Codebird\Codebird-&gt;oauth_requestToken(Array)
#4 {main}
  thrown in <b>/fullpath/Codebird.php</b> on line <b>2062</b><br />

requestUrl.php

<?php

  require_once ('Codebird.php');
  ini_set("display_errors", 1);

  \Codebird\Codebird::setConsumerKey(KEY, KEYSECRET);
  $Corecode = \Codebird\Codebird::getInstance();

  if (isset($_GET['oauth_verifier'])) {

    $Corecode->setToken($_GET['oauth_token'], $_GET['oauth_token_secret']);

    $accOuth = $Corecode->oauth_accessToken([
      'oauth_verifier' => $_GET['oauth_verifier']
    ]);

   // adding to db

    echo "Account added.";
    die();

  } else {

    $requestToken = $Corecode->oauth_requestToken([
      'oauth_callback' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']
    ]);

    $Corecode->setToken($requestToken->oauth_token, $requestToken->oauth_token_secret);

    $addAcc = $Corecode->oauth_authorize();
    echo explode("oauth_token=", $addAcc)[1];

  }

I am using version 3.1.0

mynetx commented 8 years ago

Are you still seeing this? Do you watch for any rate limits?

mynetx commented 7 years ago

Closing due to no further replies.