Codiga Fan #26429

    The following code will create a curl object and call the initCurl() function with the given URL. After the curl object is created, the following configuration options are set: CURLOPT_SSL_VERIFYPEER is set to false to disable ssl verification, CURLOPT_SSL_VERIFYHOST is set to false to disable ssl verification of the hostname, CURLOPT_VERBOSE is set to false to disable verbose output, and CURLOPT_USERPWD is set to the user's password. Finally, CURLOPT_RETURNTRANSFER is set to true so that the curl object will return the result of the call.

    public function initCurl($apiurl)
          global $key, $url;
          //echo $url .'api/'.$apiurl;
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
          curl_setopt($ch, CURLOPT_VERBOSE, false);
          curl_setopt($ch, CURLOPT_USERPWD, $key . ':');
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_URL, $url . 'api/' . $apiurl);
          return $ch;
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.