View on GitHub

SimplecURL

Easy to use HTTP Client for PHP

SimplecURL - Making a Request

This project is archived. Use at your own caution.


Creating a new Client

To make requests, you need to create a client:

$client = new SimplecURL\Client;

Sending a Request

$res = $client->request('GET', 'http://127.0.0.1:8080/');

The above code snippet sends a GET request to http://127.0.0.1:8080/.

You can also use other methods, such as DELETE, to make your requests:

$res = $client->request('DELETE', 'http://127.0.0.1:8080/');

Sending POST Data

If you want to send some form data using a POST request, pass it to request()’s options array:

$res = $client->request('POST', 'http://127.0.0.1:8080/', [
    'postfields' => [
        'Foo' => 'Bar'
    ]
]);

This will add the POST parameter Foo with a value of Bar to your request.

Next: Parameter Bags