PHP: Call to undefined function: simplexml_load_string()

前端 未结 7 596
名媛妹妹
名媛妹妹 2020-12-13 23:02

I am implementing facebook count function using cron file. In which cron runs every 10 minutes and counts the total likes of a page.

for($i=0;$i<3;$i++){
         


        
7条回答
  •  醉酒成梦
    2020-12-13 23:37

    Make sure that you have php-xml module installed and enabled in php.ini.

    You can also change response format to json which is easier to handle. In that case you have to only add &format=json to url query string.

    $rest_url = "http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=".urlencode($source_url);
    

    And then use json_decode() to retrieve data in your script:

    $result = json_decode($content, true);
    $fb_like_count = $result['like_count'];
    

提交回复
热议问题