Skip to content

wang-sitong/perfect-curl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wangsitong/perfect-curl

中文文档

Easy for request,perfect for request

Support various request modes like get post put delete

Various request content types are supported like json and x-www-form-urlencoded

Elegant completion requirements

Examples:

use PerfectCURL\PerfectCURL;
// default get
$request = (new PerfectCURL())
    ->setUrl('https://www.moedict.tw/a/好.json')
    ->start();
var_dump($request);
use PerfectCURL\PerfectCURL;
// post
$curl = new PerfectCURL();
$result = $curl->setHeaders(["Authorization:Bearer " . 'efg',])
    ->setUrl('https://www.google.com')
    ->setType("post")
    ->setContentType("json")
    ->setProxy("127.0.0.1:1234")
    ->start();
    
var_dump($result);

$code = $curl->getHttpCode();
$info = $curl->getHttpInfo();
$error = $curl->getError();
var_dump($code);
var_dump($info);
var_dump($error);

About

Easy for request

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages