Jump to content
dsp77

Twitter API upload image

Recommended Posts

<?php
function image_upload($image, $status){

require ('tmhOAuth.php'); //https://github.com/themattharris/tmhOAuth

$tmhOAuth = new tmhOAuth(array(
'consumer_key' => "sfdgdsgsdfg",
'consumer_secret' => "dsfgdsfgdsfgsd",
'user_token' => "sdfsdfsdf",
'user_secret' => "fgdgdfgdf",
));

$code = $tmhOAuth->request( 'POST','https://api.twitter.com/1.1/statuses/update_with_media.json',
array(
'media[]' => "@{$image};type=image/jpeg;filename={$image}",
'status' => $status,
),
true, // use auth
true // multipart
);

return $code;
}
echo image_upload('/var/www/crawl/img/62845745.jpg','Postat prin API');
?>

1. creati o aplicatie in twitter developer si adaugati tokenurile

2. rulati functia image_upload('calea/absoluta/a/pozei','Postat prin API');

3. il puteti cupla cu cel de facebook

4. adaugati in cron

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...