3

instead query facebook for data i would want to parse a web pages but the problem is facebook data are loaded on client side with ajax calls so i think i can't fetch on first query on the web page. Is there a way to get facebook likes or shares on a page without query fb?

i would like to parse webpages with PHP somehow and i just check here but it's not what i want: link

EDIT

What i tried is:

<?php
    $source_url = "https://www.facebook.com/pages/%D0%9F%D1%83%D0%BB%D1%81%D0%B0%D1%80/177521286028";

    $fql  = "SELECT url, normalized_url, share_count, like_count, comment_count, ";
    $fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM ";
    $fql .= "link_stat WHERE url = 'http://pulsar.com.mk'";

    $apifql="https://api.facebook.com/method/fql.query?format=json&query=".urlencode($fql);
    $json = file_get_contents($apifql);
?>
Community
  • 1
  • 1
Emrah Mehmedov
  • 1,492
  • 13
  • 28

1 Answers1

0

You could try to use simpleXML http://www.php.net/manual/en/simplexml.examples-basic.php

  • problem is facebook like count is loaded with ajax call after page is ready, so im not sure if this will help. – Emrah Mehmedov Feb 01 '13 at 16:44
  • I think if you had a cronjob run to parse the xml grab your facebook likes, maybe deposit them in an xml file or database, you could use ajax to grab the data and display it on the page. – Explicit Brand Design Feb 01 '13 at 16:58
  • If you want to play around with xml parsing, I have used google spreadsheets, fun way to collect data. – Explicit Brand Design Feb 01 '13 at 16:59
  • how can i grab data if facebook like value is added after page is ready? i mean when you page with HTTP request you don't get the facebook widgets as HTMl but as javascript library after then ajax call is sent to grab widget content. i think i need a way of calling that data also when i grab the page. – Emrah Mehmedov Feb 04 '13 at 09:31