简体   繁体   English

节点Js请求发布未将表单POST数据发送到LAMP服务器

[英]Node Js request post not sending the form POST data to LAMP server

This is sample code which is not posting the form data to php server, null data is recived 这是示例代码,未将表单数据发布到php服务器,未获取空数据

The below code will send the complete html data to php where in php i'm converting to doc format for the html and start downloading automatically, but currently node js is not sending me the post value to php server to the url http://domain.com/index.php 下面的代码会将完整的html数据发送到php,其中在php中,我正在将html转换为doc格式并开始自动下载,但是当前node js并未将邮寄到php服务器的值发送到url http:// domain.com/index.php

exports.download = function (req, res) {
    var doc = "<html><body>content</body></html>";
    var doctype = req.body.doctype; 
    var fs = require('fs');
    var request = require('request');
    var request_url_docx = 'http://domain.com/index.php';
    var r = request.post(request_url_docx);
    var time_stamp = Date.now()/1000;
    var form = r.form();
    form.append('filename', doctype+"_"+time_stamp);
    form.append('filedata',doc);
    r.pipe(res);
}

As i Found a middle where you can use simple post to action to url to php file when event occur where you can process the document section for the HTML which is available in the phpdoc module you can generate the HTML to DOC in Node Js 当我找到一个中间位置时,可以在事件发生时使用简单的发布操作来将URL链接到php文件,在该事件中您可以处理phpdoc模块中可用的HTML的文档部分,因此可以在Node Js中生成HTML到DOC

This works for me. 这对我有用。

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

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