2012-04-27 48 views
7

我需要在ubuntu中調用HTTP請求我該怎麼做?我似乎無法找到如何做到這一點的答案?Ubuntu中的HTTP請求

如何在不調用瀏覽器如lynx的情況下運行以下url來執行此操作?

http://www.smsggglobal.com/http-api.php?action=sendsms&user=asda&password=123123&&from=123123&to=1232&text=adsdad 

回答

14
在命令提示符

,運行以下命令:

curl http://www.smsggglobal.com/http-api.php?action=sendsms&user=asda&password=123123&&from=123123&to=1232&text=adsdad 

curl命令對給定的url和參數執行http請求。

如果需要指定其他HTTP方法,use curl -X <TYPE> <URL>,像這樣:

curl -X POST http://www.smsggglobal.com/http-api.php?action=sendsms&user=asda&password=123123&&from=123123&to=1232&text=adsdad 

捲曲文檔:http://curl.haxx.se/docs/manpage.html

3

顯示結果:

curl http://www.smsggglobal.com/http-api.php?action=sendsms&user=asda&password=123123&&from=123123&to=1232&text=adsdad 

將結果保存爲文件

wget http://www.smsggglobal.com/http-api.php?action=sendsms&user=asda&password=123123&&from=123123&to=1232&text=adsdad