mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-10-10 14:05:32 +00:00
Fix #347: Add basic support for requests using relative paths
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use \Curl\Curl;
|
||||
|
||||
$curl = new Curl('https://www.example.com/api/');
|
||||
|
||||
// https://www.example.com/api/test?key=value
|
||||
$response = $curl->get('test', array(
|
||||
'key' => 'value',
|
||||
));
|
||||
assert('https://www.example.com/api/test?key=value' === $curl->url);
|
||||
assert($curl->url === $curl->effectiveUrl);
|
||||
|
||||
// https://www.example.com/root?key=value
|
||||
$response = $curl->get('/root', array(
|
||||
'key' => 'value',
|
||||
));
|
||||
assert('https://www.example.com/root?key=value' === $curl->url);
|
||||
assert($curl->url === $curl->effectiveUrl);
|
||||
Reference in New Issue
Block a user