jblond/phpcurl

A php curl client

1.1.1 2023-11-19 13:23 UTC

This package is auto-updated.

Last update: 2024-11-19 15:41:04 UTC


README

install

composer require jblond/phpcurl

example

<?php

use jblond\phpcurl\Client;
use jblond\phpcurl\Decoder;

require './vendor/autoload.php';

$client = new Client();
$decoder = new Decoder();
$response = $client->get('http://localhost/test.json');
if( !is_array($response)){
    $content = $decoder->jsonToArray($response);
}
else
{
    $content = $response;
}
print_r($content);
print_r(
    $client->post(
        'http://localhost/post.php',
        json_encode(['lorem' => 'lol'])
    )
);