2012-12-02 1 views
1

Je suis en train de faire un plugin wordpress qui va chercher tweets twitter via l'API et les échos à la page si un shortcode [twitter] est inséré sur une page.Wordpress erreur de fonction init_curl()

Je reçois une erreur:

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

Il n'y a pas d'erreur de syntaxe dans le code ne s il y a une erreur logique.

Voici le 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)); 



} 


?> 

S'il vous plaît laissez-moi savoir ce que je suis absent.

Répondre