From d27bfde24fca388f29a6d26aff54395289559ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Ram=C3=ADrez?= Date: Fri, 20 Feb 2015 08:12:10 -0600 Subject: [PATCH] Update OpenGraph.php I added a fix for sites like www.nytimes.com because sites like it needs a cookie file in order to work. Otherwise the curl will retrieve a page that is not the actual page we want to read. --- OpenGraph.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenGraph.php b/OpenGraph.php index af2e7b6..a960af8 100644 --- a/OpenGraph.php +++ b/OpenGraph.php @@ -59,6 +59,9 @@ static public function fetch($URI) { curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); + //The following 2 set up lines work with sites like www.nytimes.com + curl_setopt($curl, CURLOPT_COOKIEFILE, "cookie.txt"); //you can change this path to whetever you want. + curl_setopt($curl, CURLOPT_COOKIEJAR, "cookie.txt"); //you can change this path to whetever you want. $response = curl_exec($curl);