-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No media uploaded only status #274
Comments
Sorry $ temp is |
$result is following: |
@J7mbo do you need something else? |
Hey @koese66, looks like you get a result. So what exactly is the problem? Looks like you get a media id in the first step, which is what you want, and then you try and upload it. |
Hey @J7mbo I cant see my post with the image. There is only the staus written.See here: https://twitter.com/schuhfachmann |
Okay, can you please run this code, separate from any other code that you are running. Just open a plain PHP script, put in the configuration required to make Make sure you insert a proper path to your image, and some text for your tweet. Can you let me know the result on your twitter account?
|
There seems to be a problem with this part of code: |
I use this part of code and I get the media ID in the first step |
Ah. Create a new twitter api exchange object for the second request and use that one instead. |
You mean this? Right? This also doesnt work. |
You get an error with "This page does not work" - but I'm not sure where this error message comes from. It could come from your web server or a framework, but it doesn't look like it comes from the API call nor from any custom error messages in the library code. Can you put the code into a simple PHP script (.php) and then execute that php script with nothing else in it? |
If you have access to terminal, running "php myscript.php" will be good enough. |
Fatal error: Call to a member function request() on null in /www/htdocs/xxxxxx/myscript.php on line 11 |
Debugging time - why is your |
Now I get it. Here is the var_dump array(23) { ["created_at"]=> string(30) "Wed Feb 13 15:48:03 +0000 2019" ["id"]=> int(1095711206084624384) ["id_str"]=> string(19) "1095711206084624384" ["text"]=> string(6) "Rieker" ["truncated"]=> bool(false) ["entities"]=> array(4) { ["hashtags"]=> array(0) { } ["symbols"]=> array(0) { } ["user_mentions"]=> array(0) { } ["urls"]=> array(0) { } } ["source"]=> string(74) "Schuhfachmann.de" ["in_reply_to_status_id"]=> NULL ["in_reply_to_status_id_str"]=> NULL ["in_reply_to_user_id"]=> NULL ["in_reply_to_user_id_str"]=> NULL ["in_reply_to_screen_name"]=> NULL ["user"]=> array(42) { ["id"]=> int(272901659) ["id_str"]=> string(9) "272901659" ["name"]=> string(16) "Schuhfachmann.de" ["screen_name"]=> string(13) "schuhfachmann" ["location"]=> string(5) "Gotha" ["description"]=> string(166) "https://t.co/zODg2HBZkX ist Ihr zuverlässiger Modepartner für den unkomplizierten Schuh- und Accessoires-Einkauf im Internet. Impressum: https://t.co/WE1lrq1YOS" ["url"]=> string(22) "http://t.co/5bER2wLsrp" ["entities"]=> array(2) { ["url"]=> array(1) { ["urls"]=> array(1) { [0]=> array(4) { ["url"]=> string(22) "http://t.co/5bER2wLsrp" ["expanded_url"]=> string(27) "http://www.schuhfachmann.de" ["display_url"]=> string(16) "schuhfachmann.de" ["indices"]=> array(2) { [0]=> int(0) [1]=> int(22) } } } } ["description"]=> array(1) { ["urls"]=> array(2) { [0]=> array(4) { ["url"]=> string(23) "https://t.co/zODg2HBZkX" ["expanded_url"]=> string(23) "http://Schuhfachmann.de" ["display_url"]=> string(16) "Schuhfachmann.de" ["indices"]=> array(2) { [0]=> int(0) [1]=> int(23) } } [1]=> array(4) { ["url"]=> string(23) "https://t.co/WE1lrq1YOS" ["expanded_url"]=> string(27) "http://tinyurl.com/yc4sq5ow" ["display_url"]=> string(20) "tinyurl.com/yc4sq5ow" ["indices"]=> array(2) { [0]=> int(141) [1]=> int(164) } } } } } ["protected"]=> bool(false) ["followers_count"]=> int(720) ["friends_count"]=> int(1794) ["listed_count"]=> int(26) ["created_at"]=> string(30) "Sun Mar 27 12:05:53 +0000 2011" ["favourites_count"]=> int(0) ["utc_offset"]=> NULL ["time_zone"]=> NULL ["geo_enabled"]=> bool(false) ["verified"]=> bool(false) ["statuses_count"]=> int(10252) ["lang"]=> string(2) "de" ["contributors_enabled"]=> bool(false) ["is_translator"]=> bool(false) ["is_translation_enabled"]=> bool(false) ["profile_background_color"]=> string(6) "C0DEED" ["profile_background_image_url"]=> string(48) "http://abs.twimg.com/images/themes/theme1/bg.png" ["profile_background_image_url_https"]=> string(49) "https://abs.twimg.com/images/themes/theme1/bg.png" ["profile_background_tile"]=> bool(false) ["profile_image_url"]=> string(84) "http://pbs.twimg.com/profile_images/1290282823/schuhfachmann_1600x1600neu_normal.jpg" ["profile_image_url_https"]=> string(85) "https://pbs.twimg.com/profile_images/1290282823/schuhfachmann_1600x1600neu_normal.jpg" ["profile_banner_url"]=> string(58) "https://pbs.twimg.com/profile_banners/272901659/1431091458" ["profile_link_color"]=> string(6) "1DA1F2" ["profile_sidebar_border_color"]=> string(6) "C0DEED" ["profile_sidebar_fill_color"]=> string(6) "DDEEF6" ["profile_text_color"]=> string(6) "333333" ["profile_use_background_image"]=> bool(true) ["has_extended_profile"]=> bool(false) ["default_profile"]=> bool(true) ["default_profile_image"]=> bool(false) ["following"]=> bool(false) ["follow_request_sent"]=> bool(false) ["notifications"]=> bool(false) ["translator_type"]=> string(4) "none" } ["geo"]=> NULL ["coordinates"]=> NULL ["place"]=> NULL ["contributors"]=> NULL ["is_quote_status"]=> bool(false) ["retweet_count"]=> int(0) ["favorite_count"]=> int(0) ["favorited"]=> bool(false) ["retweeted"]=> bool(false) ["lang"]=> string(2) "nl" } |
The function request wasnt in the TwitterAPIExchange.php |
Are you using an old version of the lib? That function has been there for a while now... |
Perhaps 2 years... |
Hope all is solved now? :) |
no there is no solution yet :) I can only see my status posted. Do you see the product image? |
And you are definitely running the code I put above, with only minor changes to use your image and tweet text, and running php myscript.php? |
I have only additional code to get my status and the image from database. `<?php require $_SERVER['DOCUMENT_ROOT'] . "includes/application_top_export.php"; $settings = array( $error = false; /* Upload image */ $twitter = new TwitterAPIExchange($settings); /** Store the media id for later **/ $mediaId = $data['media_id']; /* Create tweet and reference image */ $data = @json_decode($data, true); ?>` |
@J7mbo Can you help me now :) |
Hello @J7mbo here is my code:
`function MediaUpload($temp) {
}
function StatusesUpdate($media_ids)
{
global $settings;
if (!$media_ids)
{
$this->fail('Cannot /update status because /upload failed');
}
$url = 'https://api.twitter.com/1.1/statuses/update.json';
$method = 'POST';
$params = array(
'status' => 'mypage.de',
'possibly_sensitive' => false,
'media_ids' => $media_ids
);
}`
The text was updated successfully, but these errors were encountered: