curl get request code example
Example 1: curl post json
curl -X POST -H "Content-Type: application/json" \
-d '{"username":"abc","password":"abc"}' \
https:
Example 2: curl post request
curl -d "user=user1&pass=abcd" -X POST https:
Example 3: php curl get
PHP cURL GET Request
A GET request retrieves data from a server. This can be a website’s HTML, an API response or other resources.
<?php
$cURLConnection = curl_init();
curl_setopt($cURLConnection, CURLOPT_URL, 'https://hostname.tld/phone-list');
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
$phoneList = curl_exec($cURLConnection);
curl_close($cURLConnection);
$jsonArrayResponse - json_decode($phoneList);
Example 4: curl get example
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http:
Example 5: curl post
curl --data '' https:
curl -X POST https:
curl --request POST https:
Example 6: curl https post
curl -d "" https:
curl -H "Content-Type: application/json" --data "@C:\Users\xxx\Desktop\body.json" https: