From c86e86d9171f237491c72dbca194149d1d2f3243 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Wed, 1 Mar 2017 19:00:47 -0800 Subject: [PATCH] Fix #428: Add custom request example --- examples/custom.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/custom.php diff --git a/examples/custom.php b/examples/custom.php new file mode 100644 index 0000000..3029bde --- /dev/null +++ b/examples/custom.php @@ -0,0 +1,19 @@ +setOpt(CURLOPT_CUSTOMREQUEST, 'GET'); +$curl->setOpt(CURLOPT_NOBODY, true); +$curl->setOpt(CURLOPT_HEADER, true); +$curl->setUrl('https://httpbin.org/get'); +$curl->exec(); + +if ($curl->error) { + echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage . "\n"; +} else { + echo 'Response:' . "\n"; + var_dump($curl->response); +}