Przeglądaj źródła

Update curl_setopt()

Visman 2 lat temu
rodzic
commit
cdbcfa8d09

+ 2 - 0
app/Models/Provider/Driver.php

@@ -158,6 +158,8 @@ abstract class Driver extends Model
             return false;
         }
 
+        \curl_setopt($ch, \CURLOPT_MAXREDIRS, 10);
+        \curl_setopt($ch, \CURLOPT_TIMEOUT, 10);
         \curl_setopt($ch, \CURLOPT_HTTPHEADER, ['Accept: application/json']);
         \curl_setopt($ch, \CURLOPT_POST, true);
         \curl_setopt($ch, \CURLOPT_POSTFIELDS, \http_build_query($params));

+ 4 - 1
app/Models/Provider/Driver/GitHub.php

@@ -43,8 +43,11 @@ class GitHub extends Driver
             return false;
         }
 
+        \curl_setopt($ch, \CURLOPT_MAXREDIRS, 10);
+        \curl_setopt($ch, \CURLOPT_TIMEOUT, 10);
         \curl_setopt($ch, \CURLOPT_HTTPHEADER, $headers);
-        \curl_setopt($ch, \CURLOPT_POST, false);
+        \curl_setopt($ch, \CURLOPT_HTTPGET, true);
+//        \curl_setopt($ch, \CURLOPT_POST, false);
         \curl_setopt($ch, \CURLOPT_RETURNTRANSFER, true);
         \curl_setopt($ch, \CURLOPT_HEADER, false);