PHP code example of cmq2080 / curl_spear

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

    

cmq2080 / curl_spear example snippets


$client = \cmq2080\curl_spear\Client::instance();

$requestUrl = 'http://www.cmq2080.top/';
$queryParams = ['r' => 'timestamp'];

$client->get($requestUrl, $queryParams);
$resp = $client->getResponse();

print_r($resp->getCode());

if ($resp->isSuccess()) {
    print_r($resp->getContent());
}