Ecommerce Shopify WordPress Discussion

WordPress/API/Twitter to bring latest tweet inside my WordPress doesnt' work, I get error 404 couldn't retrieve tweets

I'm using local Wordpress to test my plugin but it doesn't work for some reason, I do have the consumer/access just wrote ??? to hide sensitive info. What happens is that it responds with error code 404, I'm not sure if its the code that's not working or if it is some type of settings I need to change to make it work. I have tried the most things but right now I am on a dead end without any further progress. <?php /* Plugin Name: Social media crawler Description: ??? Version: 1.0 Author: ??? License: GPL2 License URI: Domain Path: /languages */ require "vendor/autoload.php"; use Abraham\TwitterOAuth\TwitterOAuth; function my_twitter_feed_function() { // Set up your Twitter API credential $consumer_key = '???'; $consumer_secret = '???'; $access_token = '???'; $access_token_secret = '???'; // Set up the connection $connection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret); // The Twitter handle of the user you want to retrieve tweets from $twitterHandle = 'eldoradotest'; $tweets = $connection->get("statuses/user_timeline", ["screen_name" => $twitterHandle, "count" => 1, "exclude_replies" => true]); $output = ''; // Check for errors if ($connection->getLastHttpCode() == 200) { // Loop through the tweets and build the output foreach ($tweets as $tweet) { $output .= '<div class="tweet">' . $tweet->text . '</div>'; } } else { // Handle errors more robustly $errorBody = $connection->getLastBody(); if ($errorBody && isset($errorBody->errors) && is_array($errorBody->errors)) { $output .= "Failed to retrieve tweets: " . $errorBody->errors[0]->message; } else { $output .= "Failed to retrieve tweets. Error code: " . $connection->getLastHttpCode(); } } return $output; } add_shortcode('my_twitter_feed', 'my_twitter_feed_function');
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.