Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fetches a dad joke from
$url = '';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept:text/plain']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
echo $data;
Copy link

keshon commented Aug 8, 2019

Simple and elegant, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment