php - Function returns post URLs rather than retrieving Facebook Graph API data -


require('../wp-blog-header.php'); query_posts('&showposts=-1&order=asc');  while (have_posts()) : the_post();          $url = the_permalink();         $json = file_get_contents( 'https://graph.facebook.com/fql?q=select%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20from%20link_stat%20where%20url%20=%20%27' . $url . '%27' );         $json_data = json_decode($json, false);         echo $json_data->data[0]->total_count;         echo '<br>';      endwhile; 

the above code, rather returning total share count, returns posts urls.

how can make return total_count value each post ? suspect line 6 needs return urls first before next line task..

regards,

thanks!

someone in wordpress development network pointed me this:

the_permalink(); doesn't return permalink, prints it, should use get_the_permalink(); instead:

$url = get_the_permalink(); 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -