PHP code example of orangephp / curl-to-cli

1. Go to this page and download the library: Download orangephp/curl-to-cli library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

orangephp / curl-to-cli example snippets


    $handler = OrangePHP\curl_init($this->endpoint . $url);
    OrangePHP\curl_setopt($handler, CURLOPT_HTTPHEADER, $headers);
    OrangePHP\curl_setopt($handler, CURLOPT_TIMEOUT, 65);
    
    OrangePHP\curl_setopt($handler, CURLOPT_POSTFIELDS, $jsonData);
    OrangePHP\curl_setopt($handler, CURLOPT_POST, 1);
    
    OrangePHP\curl_setopt($handler, CURLOPT_CUSTOMREQUEST, $customRequest);
    OrangePHP\curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
    OrangePHP\curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, $this->verifySSL);
    
    $response = OrangePHP\curl_exec($handler);
    $httpCode = OrangePHP\curl_getinfo($handler, CURLINFO_HTTP_CODE);

    $curlCLICommand = OrangePHP\convert_to_cli();
    error_log("CURL CLI: $curlCLICommand");