PHP code example of xpf0000 / php-curl

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

    

xpf0000 / php-curl example snippets


$curl = new Curl('https://www.google.com'); // 初始化一个实例
$curl = Curl::init('https://www.google.com'); // 初始化一个实例 使用类方法
$curl->head(['token'=>'aaabbbccc'])
     ->data(['a'=>0,'b'=>1])
     ->post(); // 返回字符串数据
$curl->get(CURL_RETURN_JSON); // 把返回字符串格式化成JSON