Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Last active March 3, 2025 18:04
Show Gist options
  • Save jhowbhz/af4508f6fc6f1ec90017d8fb78dda8f8 to your computer and use it in GitHub Desktop.
Save jhowbhz/af4508f6fc6f1ec90017d8fb78dda8f8 to your computer and use it in GitHub Desktop.
Curl PHP Example
<?php
$URL_REQUEST = "https://jsonplaceholder.typicode.com/posts/1");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, URL_REQUEST);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
"Accept: application/json"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);die;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment