mrjnamei/curl

A http(s) client of php

Maintainers

Details

github.com/mrjnamei/curl

Source

Issues

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/mrjnamei/curl

dev-master 2017-06-01 05:23 UTC

This package is not auto-updated.

Last update: 2025-10-04 01:00:48 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',
        ........
    ];