使用curl命令可以獲取返回?cái)?shù)據(jù)。以下是一個簡單的示例:
curl https://example.com/api/endpoint
在這個例子中,curl命令將發(fā)送一個GET請求到https://example.com/api/endpoint,并返回該請求的響應(yīng)數(shù)據(jù)。
如果您希望將返回?cái)?shù)據(jù)保存到文件中,可以使用-o選項(xiàng):
curl -o output.txt https://example.com/api/endpoint
這將把返回?cái)?shù)據(jù)保存到output.txt文件中。
如果您希望在終端中查看返回?cái)?shù)據(jù)而不保存到文件中,可以使用-o選項(xiàng):
curl https://example.com/api/endpoint
這將在終端中顯示返回?cái)?shù)據(jù)。