Follow HTTP redirects in get_contents() too
[tweeper.git] / tweeper.php
index 14c3a7a..923b303 100644 (file)
@@ -51,12 +51,13 @@ class Tweeper {
   {
     $ch = curl_init($url);
     curl_setopt_array($ch, array(
   {
     $ch = curl_init($url);
     curl_setopt_array($ch, array(
-        CURLOPT_HEADER => FALSE,
-        CURLOPT_RETURNTRANSFER => TRUE,
-        CURLOPT_SSL_VERIFYHOST => FALSE,
-        CURLOPT_SSL_VERIFYPEER => FALSE,
-        CURLOPT_HTTPHEADER => array('Accept-language: en'),
-        CURLOPT_USERAGENT => Tweeper::$USER_AGENT,
+      CURLOPT_HEADER => FALSE,
+      CURLOPT_FOLLOWLOCATION => TRUE,  // follow http redirects to get the real URL
+      CURLOPT_RETURNTRANSFER => TRUE,
+      CURLOPT_SSL_VERIFYHOST => FALSE,
+      CURLOPT_SSL_VERIFYPEER => FALSE,
+      CURLOPT_HTTPHEADER => array('Accept-language: en'),
+      CURLOPT_USERAGENT => Tweeper::$USER_AGENT,
     ));
     $contents = curl_exec($ch);
     curl_close($ch);
     ));
     $contents = curl_exec($ch);
     curl_close($ch);
@@ -68,13 +69,13 @@ class Tweeper {
   {
     $ch = curl_init($url);
     curl_setopt_array($ch, array(
   {
     $ch = curl_init($url);
     curl_setopt_array($ch, array(
-        CURLOPT_HEADER => TRUE,
-        CURLOPT_NOBODY => TRUE,
-        CURLOPT_FOLLOWLOCATION => TRUE,  // follow http redirects to get the real URL
-        CURLOPT_RETURNTRANSFER => TRUE,
-        CURLOPT_SSL_VERIFYHOST => FALSE,
-        CURLOPT_SSL_VERIFYPEER => FALSE,
-        CURLOPT_USERAGENT => Tweeper::$USER_AGENT,
+      CURLOPT_HEADER => TRUE,
+      CURLOPT_NOBODY => TRUE,
+      CURLOPT_FOLLOWLOCATION => TRUE,  // follow http redirects to get the real URL
+      CURLOPT_RETURNTRANSFER => TRUE,
+      CURLOPT_SSL_VERIFYHOST => FALSE,
+      CURLOPT_SSL_VERIFYPEER => FALSE,
+      CURLOPT_USERAGENT => Tweeper::$USER_AGENT,
     ));
     curl_exec($ch);
     $url_info = curl_getinfo($ch);
     ));
     curl_exec($ch);
     $url_info = curl_getinfo($ch);