Node calls the php interface, how does node.js access a php interface?

default-user-image.png

Yes, take GET request as an example

var http = require(‘http’);

var qs = require(‘querystring’);

var data = {

a: 123,

time: new Date().getTime()};//This is the data that needs to be submitted

var content = qs.stringify(data);

var options = {

hostname: ‘127.0.0.1’,

port: 10086,

path: ‘/pay/pay_callback?’ + content,

method: ‘GET’

};

var req = …

This article is reprinted from https://blog.p2hp.com/archives/8555
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment