无法在POST php网络服务中获取值 [英] Unable to get values in POST php web serivce

查看:68
本文介绍了无法在POST php网络服务中获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在php中制作了Web服务,该服务将通过参数发送的电子邮件发送给卖家.如果我们在GET中发送这些信息,则Web服务运行良好.但是,如果我们在POST中发送该信息,则Web服务(php脚本)什么也不会显示.

I have made web service in php, which sends email to seller with information which is sent in parameters. If we are sending those information in GET, the web service works well. But if we send that information in POST, the web service (php script) shows nothing.

这是该Web服务的URL:

Here is url of that web service :

目前,我只是显示使用传递的参数

Currently i am just showing param passed using

print_r($ _ REQUEST);

print_r($_REQUEST);

这很好,因为我正在GET中发送那些参数,但是我试图使用chrome扩展名"Simple REST client"在POST中发送那些参数,所以我什么也没得到.

Well this is working fine because i am sending those paramerters in GET but I am trying to send those parameters in POST using chrome extension "Simple REST client", I am getting nothing.

我猜想,我需要在脚本中设置标头,但是不确定.或者,当调用该Web服务时,我们需要在请求中设置任何东西标头.

I guess, I need to set headers in my script, but not sure about that. Or when calling that web service we need to set any thing header in request.

以下是通过POST发送请求的方式:

Here is how request via POST is send :

Ext.Ajax.request({
                url: this.getBaseUrl() + webServiceUrl,
                timeout: 240000,
                method: httpMethod,
                disableCaching: false,
                useDefaultXhrHeader: false,
                jsonData : {
             "seller_id":seller_id,
             "name":name,
             "email":email,
             "mobile":mobile,
             "area":area,
             "message":message              },
                scope: me,
                success: function(response) {
                 Ext.Viewport.unmask();
                    successCallBack(response);
                },
                failure: function(response) {
                 Ext.Viewport.unmask();
                   failureCallback(response);
                }
            });

我们将不胜感激.

谢谢.. 安朱姆

推荐答案

尝试将jsonData放在params中,如下所示:

Try putting the jsonData in params as follows :

Ext.Ajax.request({
            url: this.getBaseUrl() + webServiceUrl,
            timeout: 240000,
            method: httpMethod,
            disableCaching: false,
            useDefaultXhrHeader: false,
            params: {
              jsonData : {
                   "seller_id":seller_id,
                   "name":name,
                   "email":email,
                   "mobile":mobile,
                   "area":area,
                   "message":message              },
            }},
            success: function(response){
            var text = response.responseText;
            // process server response here
}
});

这篇关于无法在POST php网络服务中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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