mrjnamei / curl
A http(s) client of php
dev-master
2017-06-01 05:23 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-06-13 23:37:42 UTC
README
- Usage
$options = [] ;
$http = new mrjnamei\Curl($options);
// http get
$url = "http://www.google.com";
$res = $http->get($url,["name" => "jack"]); // $res is the response
$res = $http->post($url,["name" => "jack"]); // post request
- construct options
$options = [
'base_path' => 'http://www.google.com/' , //base path
'headers' => [
'Content-Type' => 'text/html;charset=utf-8',
],
'CURLOPT_CONNECTTIMEOUT' => 30 , //timeout
'CURLOPT_SSL_VERIFYPEER' => true , // use ssl
'CURLOPT_CAINFO' => 'path/to/cert.pem',
........
];