Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8942265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:28:31+00:00 2026-06-15T11:28:31+00:00

I am trying to make a wordpress plugin that fetches twitter tweets via API

  • 0

I am trying to make a wordpress plugin that fetches twitter tweets via API and echoes them on page if a shortcode [twitter] is inserted on a page.

I am getting an error:

“FATAL ERROR: CALL TO UNDEFINED FUNCTION CURL_INIT() IN C:\WAMP\WWW\WP\WP-CONTENT\PLUGINS\PLOG\PLUGIN.PHP ON LINE 45”

There is no syntax error in the code neither s there any logical error.

Here is the code:

<?php
/* Plugin Name: Testing a Plugin
 * Plugin URI: http://www.wordpress.com
 * Description: Just Testing out a plugin.
 * Author: Knooww
 * Author URI: http://www.wordpress.com
 */
?>
<?php
//limit calls to API..
// Save data in cache, refresh content after an hour

add_shortcode('twitter',  function ($atts,$content){

          $atts = shortcode_atts(array('username'=>'Default-Username',
                                 'content' =>!empty($content) ? $content:'Follow me on twitter',
                                 'show_tweets'=>'false',
                                 'tweet_reset_time'=>10, //time to refresh fetch of tweets
                                 'num_tweets'=>5

            ),$atts);


    extract($atts);
    if($show_tweets){

        $tweets = fetch_tweets($num_tweets,$username,$tweet_reset_time);
    }


//return '<a href="http://www.twitter.com/'.$username.'">'.$content.'</a>';

});// end add_shortcode

function fetch_tweets($num_tweets,$username,$tweet_reset_time){

    $tweets = curl("https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name='$username'&count=2");
  print_r($tweets);  

}

function curl($url){

$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_TIMEOUT, 5);
return json_decode(curl_exec($c));



}


?>

Please let me know what I am missing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:28:32+00:00Added an answer on June 15, 2026 at 11:28 am

    Activation of PHP/CURL on windows is starting up notepad (or similar) and removing a semicolon from the following line in php.ini:

    ;extension=php_curl.dll
    

    Please Read https://www.php.net/manual/en/install.windows.extensions.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a WordPress site that has six lists on a page,
I am trying to make a plugin for WordPress. It works great, except when
I have a WordPress blog and I'm trying to make that when a user
I'm trying to make a page for use with wordpress and it's almost working,
I'm new to writing WordPress plugins. I'm trying to write a little plugin that
Hi I'm trying to write my first Wordpress plugin. I'm using classes to make
I am trying to make few changes in a wordpress page. I am able
I'm trying to make comments on my page just like the ones in wordpress.
Basically, I've been trying to make a simple Wordpress widget that displays a QR
Basically, I've been trying to make a simple Wordpress widget that displays a QR

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.