Comments (12)
I think you have an authentication issue. To use that API you need client credentials and user credentials. You would want to use the the values with the following names. You'd also need to make sure that the user has granted write permissions for that token and if the user had previously granted read only permissions, the app needs to be revoked and authorized again.
$connection = new TwitterOAuth('API Key', 'API Secret', 'Access Token', 'Access Token Secret');
OMG, the last time I created the token I didn't have the right permissions, I didn't see that it was here.
Thank you and really sorry...
from twitteroauth.
Same here. My code
<?php
require "vendor/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$connection->setApiVersion(1.1);
$connection->setTimeouts(10, 15);
$media1 = $connection->upload('media/upload', ['media' => '/code/test.mp4','media_type' => 'video/mp4', 'media_category' => 'tweet_video']);
print_r($media1);
print_r("Why are you null?");
$connection->setApiVersion(2);
$parameters = [
'text' => 'Meow Meow Meow',
'media' => ['media_ids' => [$media1->media_id_string]]
];
$result = $connection->post('tweets', $parameters);
from twitteroauth.
@lucaschevalierr Solved it! Use the chunk upload.
$media1 = $connection->upload('media/upload', ['media' => '/code/test.mp4','media_type' => 'video/mp4', 'media_category' => 'tweet_video'], ['chunkedUpload' => true]);
from twitteroauth.
@ProdigyView It doesn't work for me...
I try to do this :
$media = $connection->upload(
'media/upload',
[
'media' => 'imgs/test.jpeg',
'media_type' => 'image/jpeg',
'media_category' => 'tweet_image'
],
['chunkedUpload' => true]
);
And i have this error : property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
from twitteroauth.
I would the the absolute page to your image:
'media' => 'imgs/test.jpeg',
from twitteroauth.
I would the the absolute page to your image:
'media' => 'imgs/test.jpeg',
I already try, but it doesn't work either
from twitteroauth.
Anyone have an idea?
from twitteroauth.
And i have this error : property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
What's the rest of the error? What method is getting an invalid value?
from twitteroauth.
And i have this error : property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
What's the rest of the error? What method is getting an invalid value?
Here is the rest of the error :
from twitteroauth.
If you are not on the latest version of TwitterOAuth you would need to use the old method of setting chunkedUpload
$media = $connection->upload(
'media/upload',
[
'media' => 'imgs/test.jpeg',
'media_type' => 'image/jpeg',
'media_category' => 'tweet_image'
],
true
);
from twitteroauth.
If you are not on the latest version of TwitterOAuth you would need to use the old method of setting
chunkedUpload
$media = $connection->upload( 'media/upload', [ 'media' => 'imgs/test.jpeg', 'media_type' => 'image/jpeg', 'media_category' => 'tweet_image' ], true );
So I ran some tests:
-
When I use the Client ID and Client Secret in the variables $consumerKey and $consumerSecret WITH ['chunkedUpload' => true], I get this error:
-
When I use the Client ID and Client Secret in the variables $consumerKey and $consumerSecret WITHOUT ['chunkedUpload' => true], I get this error:
-
When I use the API Key and API Key secret in the variables $consumerKey and $consumerSecret WITH ['chunkedUpload' => true], I get this error:
-
When I use the API Key and API Key secret in the variables $consumerKey and $consumerSecret WITHOUT ['chunkedUpload' => true], I get "null":
PS: I think I am using the latest version of TwitterOAuth because when I try your code, I get this error: "Expected type 'array'. Found 'true'.”
PS2: Thank you very much for the time you spend helping me.
from twitteroauth.
I think you have an authentication issue. To use that API you need client credentials and user credentials. You would want to use the the values with the following names. You'd also need to make sure that the user has granted write permissions for that token and if the user had previously granted read only permissions, the app needs to be revoked and authorized again.
$connection = new TwitterOAuth('API Key', 'API Secret', 'Access Token', 'Access Token Secret');
from twitteroauth.
Related Issues (20)
- 500 error for TwitterOAuth HOT 4
- error on callback: Cette fonctionnalité est temporairement indisponible
- Sorry, you are not authorized to see this status HOT 1
- Send clickable links to Twitter HOT 1
- Cannot attach mp4 videos HOT 8
- I want to be able to see secrete replies HOT 1
- Unable to upload media as a string (incorrect hostname used) HOT 1
- unexpected bug HOT 1
- Nice
- return NULL HOT 6
- oauth1 PUT requests doesnt work HOT 5
- I need help migrating from old twitteroauth 1.1 to new TwitterOAuth 2.0. Can anyone provide guidance? HOT 2
- Failed to Post Tweet, HTTP error code: 404 HOT 13
- Media IDs Are Invalid HOT 1
- account/verify_credentials returns NULL HOT 3
- Can schedule tweet HOT 1
- 403 Forbidden HOT 1
- Can't retweet in PHP HOT 2
- Video Upload On twiter api using PHP HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitteroauth.