Browse Source

feat: add disableSSL feature

Hugh Harlequin 1 year ago
parent
commit
fff2d971fe
2 changed files with 16 additions and 4 deletions
  1. 1 1
      composer.json
  2. 15 3
      src/Builder.php

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "hugh/curl",
     "description": "Custom PHP Curl library for the Laravel framework - developed by Ixudra - redeveloped from Hugh",
-    "version": "6.22.3",
+    "version": "6.22.4",
     "keywords": ["Hugh", "Laravel", "Curl"],
     "homepage": "https://git.hugh2113.com/hugh",
     "license": "MIT",

+ 15 - 3
src/Builder.php

@@ -47,7 +47,7 @@ class Builder {
     /**
      * Set the Builder is in multiple
      *
-     * @param $multiple boolean   Prevent Builder fetch when it is in multiple. Default: true
+     * @param  boolean $multiple  Prevent Builder fetch when it is in multiple. Default: true
      * @return Builder
      */
     public function multiple($multiple = true) {
@@ -58,7 +58,7 @@ class Builder {
     /**
      * Set the URL to which the request is to be sent
      *
-     * @param $url string   The URL to which the request is to be sent
+     * @param   string $url  The URL to which the request is to be sent
      * @return Builder
      */
     public function to($url)
@@ -69,7 +69,7 @@ class Builder {
     /**
      * Set the request with certinfo
      *
-     * @param $certInfo boolean   Indicates whether or not the data should with certinfo. Default: true
+     * @param  boolean $certInfo  Indicates whether or not the data should with certinfo. Default: true
      * @return Builder
      */
     public function withCertInfo($certInfo = true) {
@@ -77,6 +77,18 @@ class Builder {
             ->withOption( 'VERBOSE', $certInfo );
     }
 
+    /**
+     * Disable SSL_VERIFYHOST & SSL_VERIFYPEER
+     *
+     * @param  boolean $ssl  Indicates without ssl. Default: true
+     * @return Builder
+     */
+    public function disableSSL($ssl = true)
+    {
+        return $this->curlOptions('SSL_VERIFYHOST', !$ssl)
+            ->curlOptions('SSL_VERIFYPEER', !$ssl);
+    }
+
     /**
      * Set the request return content encoding by
      *