curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://hostname/resource
curl -I http://www.example.org
curl is a command line client to send request and
get respond from command line, so it's basically
it's just way to send a request and response. Where you
send it we call it client. But with postman we can do more
than just sending request end respond.
This tool is preferred for automation,
since it is designed to work without user interaction.
curl can transfer multiple file at once.
Also A lot of API documentation provide curl
command for example when we run the request and
Postman can easily import curl command without you
manually typing the whole part of the request.
curl -i google.de
public function sendSms($mobile)
{
$message ='Your message';
$url = 'www.your-domain.com/api.php?to='.$mobile.'&text='.$message;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ($ch);
$err = curl_error($ch); //if you need
curl_close ($ch);
return $response;
}
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource