Last active
March 3, 2025 18:04
-
-
Save jhowbhz/af4508f6fc6f1ec90017d8fb78dda8f8 to your computer and use it in GitHub Desktop.
Curl PHP Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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