PHP code example of fireworkteam / curl

1. Go to this page and download the library: Download fireworkteam/curl 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/ */

    

fireworkteam / curl example snippets


    

    use Firework\Curl\Curl; // Import Curl class
    tUrl("https://httpbin.org/post"); // Add Curl url

    $response = $curl->post([
        "name" => "jonn",
        "age" => 25
    ], true);

    print_r($response);

    $url = "http://example.com/

    $curl->setUrl($url);

    $headers = ["HeaderName:HeaderValue", "HeaderName2:HeaderValue2"]
    $curl->setHeaders($headers);

    $arr = [CURLOPT_URL => "http://example.com", CURLOPT_HEADER => false]
    $curl->setCurlSettings($arr);

    $arr = ["name" => "john", "age" => 25]
    $curl->get($arr);

    $arr = ["name" => "john", "age" => 25]
    $curl->post($arr);

    $arr = ["name" => "john", "age" => 25]
    $curl->put($arr);

    $arr = ["name" => "john", "age" => 25]
    $curl->delete($arr);

    $arr = ["name" => "john", "age" => 25]
    $curl->patch($arr);