J'avais une application serveur dans asp.net dans Windows, car j'avais un service Web pour cela.
Comment puis-je appeler le service Web dans Ubuntu en utilisant un script shell en utilisant la commande cURL
Linux fournit une belle petite commande qui rend nos vies beaucoup plus faciles.
GET:
avec JSON:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource
avec XML:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource
POST:
Pour enregistrer des données:
curl --data "param1=value1¶m2=value2" http://hostname/resource
Pour le téléchargement de fichiers:
curl --form "[email protected]" http://hostname/resource
Publication HTTP RESTful:
curl -X POST -d @filename http://hostname/resource
Pour vous connecter à un site (auth):
curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
curl -L -b headers http://localhost/
Lire d'autres questions sur les étiquettes command-line scripts https