简体   繁体   English

命令行中的cURL获取响应+回调

[英]cURL from command-line get response + callback

Currently I use this: 目前我使用这个:

curl -F 'access_token=token' https://somewebsite.com/oauth/like/id

Response I receive is: 我收到的回复是:

{"meta":{"code":200},"data":null}

However, I'm sending many requests at the same time, so I don't know who's response that is. 但是,我同时发送许多请求,因此我不知道是谁的响应。 I would like to get a response to something like 我想回应类似

{'123456': {"meta":{"code":200},"data":null} }

Where 123456 is some id I send with the request. 其中123456是我随请求发送的一些ID。 A similar solution would be really appreciated. 一个类似的解决方案将不胜感激。 I've done this with PHP, however I want this to work through command-line. 我已经使用PHP完成了此操作,但是我希望它可以通过命令行工作。

Thank you. 谢谢。

Usually when you are pinging a server you should use a callback for when the response is called. 通常,当您对服务器执行ping操作时,应在调用响应时使用回调。

In the callback you should know what request it was from. 在回调中,您应该知道它来自什么请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM