How to use cURL to Get JSON Data and Decode JSON Data in PHP ? (original) (raw)

Last Updated : 23 Jul, 2025

In this article, we are going to see how to use cURL to Get JSON data and Decode JSON data in PHP.

**cURL****:**

**Approach:

**Example:

PHP `

response=curlexec(response = curl_exec(response=curlexec(curl); // Checking if any error occurs // during request or not if($e = curl_error($curl)) { echo $e; } else { // Decoding JSON data $decodedData = json_decode($response, true); // Outputting JSON data in // Decoded form var_dump($decodedData); } // Closing curl curl_close($curl); ?>

`

**Output: