Code to post JSON Data in a URL using CURL in PHP
1 2 3 4 5 6 7 8 9 |
$url='https://test.com/{your_segment}'; $jsonData='{"name":"Example", "email":"example@test.com" }'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); curl_close($ch); |