相当于Node.js中的cURL? [英] cURL equivalent in Node.js?

查看:74
本文介绍了相当于Node.js中的cURL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过Node.js使用HTTP请求中的信息(即调用远程Web服务并将响应回显给客户端).

I'm looking to use information from an HTTP request using Node.js (i.e. call a remote web service and echo the response to the client).

在PHP中,我应该使用cURL来做到这一点. Node的最佳做法是什么?

In PHP I would have used cURL to do this. What is the best practice in Node?

推荐答案

有关完整示例,请参见HTTP模块的文档:

See the documentation for the HTTP module for a full example:

https://nodejs.org/api/http.html#http_http_request_options_callback

这篇关于相当于Node.js中的cURL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆