diff --git a/examples/custom-headers.php b/examples/custom-headers.php index fbce2d3..2eb7c5d 100644 --- a/examples/custom-headers.php +++ b/examples/custom-headers.php @@ -16,14 +16,11 @@ // instantiate the Zebra_cURL class $curl = new Zebra_cURL(); -// since we are communicating over HTTPS, we load the CA bundle from the examples folder, -// so we don't get CURLE_SSL_CACERT response from cURL -// you can always update this bundle from https://curl.haxx.se/docs/caextract.html -$curl->ssl(true, 2, __DIR__ . '/cacert.pem'); +// set custom HTTP headers +$curl->option(CURLOPT_HTTPHEADER, [ + 'accept: application/json', + 'X-Token-Foo-Bar: ABC123' // Pass keys to APIs, for example +]); -$curl->get('https://postman-echo.com/get?foo=bar1', function() use (&$curl) { - echo "Call 1 finished.\n"; - // $curl->get('https://postman-echo.com/get?foo=bar2', function () { - // echo "Call 2 finished.\n"; - // }); -}); \ No newline at end of file +echo '
';
+echo $curl->scrap('http://httpbin.org/get') . PHP_EOL;