PHP code example of fightbulc / php_curl

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

    

fightbulc / php_curl example snippets


	
	$curl = CURL::init("http://reddit.com/r/php/.json");

    


    $curl = CURL::init("http://www.reddit.com/r/php/.json")
                ->setReturnTransfer(TRUE);

    


    $curl = CURL::init("http://www.reddit.com/r/php/.json")
            ->setReturnTransfer(TRUE);

    $response = $curl->execute():

    


    $ch = curl_init("http://www.example.com/");
    $fp = fopen("example_homepage.txt", "w");

    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);

    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    


    $fp = fopen("example_homepage.txt", "w");

    CURL::init("http://www.example.com/")
        ->setFile($fp)
        ->setHeader(0)
        ->execute()
        ->close();

    fclose($fp);