Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
You are here: HomeForum
Welcome, Guest

Facebook counter is 0 (IT WORKS CURL VERSION)
(1 viewing) (1) Guest
Read user-guide, report bugs and discuss more
  • Page:
  • 1

TOPIC: Facebook counter is 0 (IT WORKS CURL VERSION)

Facebook counter is 0 (IT WORKS CURL VERSION) 7 years ago #32686

  • darekmer
  • OFFLINE
  • Single Product
  • Junior Boarder
  • Posts: 20
  • Karma: 2
Hello.
rod-lubocza.pl
Sorry for english, google translator;)
My hosting blocks 'allow_url_fopen' and does not work 'file_get_contents'.
I have a question if I can replace 'file_get_contents' 'curl'?
And do you have the function 'private static function getFacebookLike'
Last Edit: 7 years ago by darekmer.

Re: Facebook counter is 0 new post 7 years ago #32696

  • darekmer
  • OFFLINE
  • Single Product
  • Junior Boarder
  • Posts: 20
  • Karma: 2
Please help. Can I replace file get content CURL?

Re: Facebook counter is 0 new post 7 years ago #32697

  • darekmer
  • OFFLINE
  • Single Product
  • Junior Boarder
  • Posts: 20
  • Karma: 2
No help via support
I did it myself
Maybe someone will use it
CURL version if "file_get_content" does not work
	private static function getFacebookLike($params){
		$id = $params->get('facebook_url');
        $appid = $params->get('appid');
        $appsecret = $params->get('appsecret');
		$ch = curl_init('https://graph.facebook.com/'.$id.'?access_token='.$appid.'|'.$appsecret.'&fields=likes');
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
		curl_setopt($ch, CURLOPT_TIMEOUT, 10);
		$response = curl_exec($ch);
		curl_close($ch);
		$json_output = json_decode($response);
        //Extract the likes count from the JSON object
        $like_count = isset($json_output->likes) ? $json_output->likes : 0;
        return $like_count;
	}
Last Edit: 7 years ago by darekmer.

Re: Facebook counter is 0 new post 7 years ago #32727

Dear darekmer

You can try to set it php.ini file for your site.
refer this link: github.com/Solutions-Nitriques/oembed_field/issues/28

thanks
  • Page:
  • 1
Time to create page: 0.21 seconds

Notification

Please find your issue via Suggested Posts before submitting your question. We have solved the most of issues and maybe your issue was solved before.

Latest My Topics

No posts to display.

Love all our templates?

Join our membership clubs starting at $49 only for access to all of our templates

Join Now
Home Pricing
Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
SearchSupport
Magento Themes Magento Extensions Free Magento Extensions Prestashop Themes Prestashop Modules Magento 2 Themes