Tips & Tutorials

Send JSON Data With PHP CURL (POST & GET)

Welcome to a tutorial on how to send JSON data with PHP CURL. Need to send some data using CURL in the JSON format? To send JSON data with PHP CURL, simply json_encode() the data before sending it out: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, “http://site.com”); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, [“KEY” => json_encode([“VALUE”, “VALUE”])]); $result …

Send JSON Data With PHP CURL (POST & GET) Read More »