Can I use the Twitter API from 000webhost site?


#1

I wanted to make some twitter app in php where posts get posted into my account.

Is that possible?
If yes, could you also please a tutorial ?


#2

That should be possible, however we have no tutorials on that :confused:


#3

I might be possible but I haven’t gotten it to work so far

when I run my code
i get the error

<?php

function tweet($message){

require_once ('codebird.php');

\Codebird\Codebird::setConsumerKey('xxxxxxx', 'xxxxxxxxx'); // static, see README

$cb = \Codebird\Codebird::getInstance();

$cb->setToken('xxxxxxxxx', 'xxxxxxxxxxxx');

print_r($cb);

$params = array(
    'status' => $message,
);
//post the tweet with codebird
$reply = $cb->statuses_update($params);

}

tweet("Uchiha Clan");

I get the error

Fatal error: Uncaught Exception: Request error for API call: in …/public_html/mangekyotweet/codebird.php:1942
Stack trace:
#0 …/public_html/mangekyotweet/codebird.php(1901): Codebird\Codebird->_callApiCurl(‘POST’, ‘statuses/update’, ‘statuses/update’, ‘status=Uchiha+C…’, false, false)
#1 …/public_html/mangekyotweet/codebird.php(799): Codebird\Codebird->_callApi(‘POST’, ‘statuses/update’, ‘statuses/update’, Array, false, false)
#2 …/public_html/mangekyotweet/index.php(19): Codebird\Codebird->__call(‘statuses_update’, Array)
#3 …/public_html/mangekyotweet/index.php(23): tweet(‘Uchiha Clan’)
#4 {main}
thrown in …/public_html/mangekyotweet/codebird.php on line 1942

and when I use the print_r($cb); to get the codebird object

I get

Codebird\Codebird Object
(
    [_oauth_token:protected] => xxxxxxxxx
    [_oauth_token_secret:protected] => xxxxxxxxxxx
    [_return_format:protected] => 0
    [_streaming_callback:protected] => 
    [_use_curl:protected] => 1
    [_timeouts:protected] => Array
        (
            [request] => 10000
            [connect] => 3000
            [remote] => 5000
        )

    [_proxy:protected] => Array
        (
        )

)

Dont know if this is a good or bad thing.

Please do some research on whethe I can use my 000webhost site for twitter.

this is what sb wrote to me on github

Please investigate whether your server can talk to the outside world (TCP 443) and whether the Twitter API is available.

On Codebird description I see that codebird-php has the following requirements:
Requirements

PHP 5.5.0 or higher
OpenSSL extension

Are these provided in 000webhost


#4

I donot think we have openSSL