1. Go to this page and download the library: Download klebervmv/easycurl 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/ */
klebervmv / easycurl example snippets
use klebervmv\EasyCurl;
$easyCurl = new EasyCurl("route url", true, "json");
use klebervmv\EasyCurl;
$easyCurl = new EasyCurl("route url");
$easyCurl->render("GET", "/ednpoint")->send();
//If there is an error in the communication, it will be returned in the getError() method;
if($easyCurl->getError()){
var_dump($easyCurl->getError());
return;
}
//Through the getHttpCode() method you can validate the return http code
if($easyCurl->getHttpCode() !== 200){
var_dump($easyCurl->getResult());
return;
}
//the result will be returned in the getResult() method in the array format
var_dump($easyCurl->getResult());
use klebervmv\EasyCurl;
$easyCurl = new EasyCurl("route url");
$param = new stdClass();
$param->firstName = "Kleberton";
$param->lastName = "Vilela";
$param->email = "[email protected]";
$easyCurl->render("POST", "/ednpoint", $param)->send();
//If there is an error in the communication, it will be returned in the getError() method;
if($easyCurl->getError()){
var_dump($easyCurl->getError());
return;
}
//Through the getHttpCode() method you can validate the return http code
if($easyCurl->getHttpCode() !== 200){
var_dump($easyCurl->getResult());
return;
}
//the result will be returned in the getResult() method in the array format
var_dump($easyCurl->getResult());
use klebervmv\EasyCurl;
$easyCurl = new EasyCurl("route url");
$easyCurl->render("GET", "/ednpoint")
->setHeader("Authorization:Bearer TOKEN")
->send();
use klebervmv\EasyCurl;
$easyCurl = new EasyCurl("route url");
$easyCurl->render("GET", "/ednpoint")
->resetHeader()
->setHeader("lang:pt-BR")
->setHeader("Authorization:Bearer TOKEN")
->send();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.