Publication on Twitter

Started by kak2z, July 03, 2015, 12:43:40 PM

Previous topic - Next topic

kak2z

Hello. Sorry for the bad english.
I want to make the publication of announcements of topics on Twitter.
I use a script https://github.com/jublonet/codebird-пхп
But he does not want to work with SSI.


That's not working.

require_once('../SSI.php');
require_once ('codebird.php');
\Codebird\Codebird::setConsumerKey('XXXXXXXXXXxx', 'YYYYYYYYYYYYYYYYYYYYYY'); // static, see 'Using multiple Codebird instances'
$cb = \Codebird\Codebird::getInstance();
$cb->setToken('HHHHHHHHHHHHHHHHHHH', 'KKKKKKKKKKKKKKKKKKKKKKKKKKK');

// these files to upload. You can also just upload 1 image!
$media_files = array(
    'http://xxxxxx.com/my_file.jpg',
);
// will hold the uploaded IDs
$media_ids = array();

foreach ($media_files as $file) {
    // upload all media files
    $reply = $cb->media_upload(array(
        'media' => $file
    ));
    // and collect their IDs
    $media_ids[] = $reply->media_id_string;
}

// convert media ids to string list
$media_ids = implode(',', $media_ids);

// send tweet with these medias
$reply = $cb->statuses_update(array(
    'status' => urlencode('These are some of my relatives.'),
    'media_ids' => $media_ids
));


That's working.

require_once ('codebird.php');
\Codebird\Codebird::setConsumerKey('XXXXXXXXXXxx', 'YYYYYYYYYYYYYYYYYYYYYY'); // static, see 'Using multiple Codebird instances'
$cb = \Codebird\Codebird::getInstance();
$cb->setToken('HHHHHHHHHHHHHHHHHHH', 'KKKKKKKKKKKKKKKKKKKKKKKKKKK');

// these files to upload. You can also just upload 1 image!
$media_files = array(
    'http://xxxxxx.com/my_file.jpg',
);
// will hold the uploaded IDs
$media_ids = array();

foreach ($media_files as $file) {
    // upload all media files
    $reply = $cb->media_upload(array(
        'media' => $file
    ));
    // and collect their IDs
    $media_ids[] = $reply->media_id_string;
}

// convert media ids to string list
$media_ids = implode(',', $media_ids);

// send tweet with these medias
$reply = $cb->statuses_update(array(
    'status' => urlencode('These are some of my relatives.'),
    'media_ids' => $media_ids
));


When I use the SSI is not working.
When I'm not using SSI - works.

What to do? What is the reason?
I have three days I can not solve this problem.
Help me please.
Thanks.
Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить

kak2z

Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить

margarett

"please"?

I would suggest that codebird tries to establish a session, while SSI has made it already. But I'm just guessing, the link you provided to Github doesn't work.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

kak2z

Quote from: margarett on July 04, 2015, 07:40:05 PM
"please"?

I would suggest that codebird tries to establish a session, while SSI has made it already. But I'm just guessing, the link you provided to Github doesn't work.

of course! please!!! please!!! please!!! 
Here the correct url https://github.com/jublonet/codebird-php



I have now found another script https://github.com/abraham/twitteroauth
but it is also nothing.
the server does not Composer. and without it he does not want to work.
require_once ("TwitterOAuth/autoload.php");
require_once("TwitterOAuth/src/TwitterOAuth.php");
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth('QQQQQQQQQQQQ', 'WWWWWWWWWWWWWW', 'DDDDDDDDDDDDDDDD', 'FFFFFFFFFFFFFFFFFFFF');

$media1 = $connection->upload('media/upload', array('media' => 'http://aquarium-vl.ru/forum/gallery/5591_02_07_15_8_54_47.jpeg'));

$parameters = array(
'status' => 'Meow Meow Meow',
'media_ids' => implode(',', array($media1->media_id_string, $media2->media_id_string)),
);
$result = $connection->post('statuses/update', $parameters);




the first script does not work with the SSI.
the second script, I could not run at all.

help me please... 
Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить

Suki

Your best bet would be using a third party service like twitterfeed.com

Standalone scripts has relatively short life spans, due to both Twitter and Facebook having way more employees than really needed, they are constantly releasing new versions of their APIs, making old versions obsolete for no reason at all.

An open source script cannot compete or keep up with their release scheduled so scripts like the one you are using become obsolete pretty fast.  This is the exat same reason why I stopped developing my twitter poster mod.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Antes

Quote from: Suki on July 05, 2015, 01:12:02 PM
Your best bet would be using a third party service like twitterfeed.com

Standalone scripts has relatively short life spans, due to both Twitter and Facebook having way more employees than really needed, they are constantly releasing new versions of their APIs, making old versions obsolete for no reason at all.

An open source script cannot compete or keep up with their release scheduled so scripts like the one you are using become obsolete pretty fast.  This is the exat same reason why I stopped developing my twitter poster mod.

Agree on first part, they are changing their APIs kinda fast & get rid of old one, but that's not for nothing because people abusing the APIs to use for commercial gain and they are building new one to cut their server costs, spam and unfair advantage.

kak2z

I want to in the announcements of Twitter were investments. To make the text the way I want ... So I want to control the processes of posting to Twitter.
I've never had so long solved the problem ..    :(
Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить

Suki

Twitterfeed uses rss so you will keep total control over everything that will be published.

I also used Abraham's lib and as far as I know it has become obsolete so the best thing you can do is go with an already established company (twitterfeed) capable of following twitter/facebook constant changes.

So, just give it a try
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Gluz

Twitterfeed using RSS is the best way to go, as I have it for 3 sites that publishes on twitter all the articles on the front page (SimplePortal) of the forums, the only "issue" is that the feed is checked every half hour, so the publication on twitter will have some delay.

kak2z

Thanks for the advice, but I do not need the services of publication.

I need my own script for publication. Why it does not work? help me please.
Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить

Suki

Why do you need your own script? what benefit could you possible get?

I would normally suggest going with open source script BUT for this specific case it is way better to just use twitterfeed, for the reasons I already explained.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Advertisement: