weixin_33725272 2015-05-14 10:58 采纳率: 0%
浏览 21

AJAX_CURL错误请求400

I am using SMS API :

  1. Through HTTP URL its working fine URL sample is:

http://testxyz.com?user=xyz&password=xyz&mob=xyz&sid=xyz&msg=xyz

  1. Through CURL curl_init($url); Its also working fine

But when I am using AJAX and call the CURL 2nd option its showing me Bad Request 400

AJAX Code

var dataString = "mobile="+mobile+"&sentSMS="+sentSMS;

$.ajax({

       type: "POST",
        url: "getMessage.php",
        data: dataString,
        async:false,
        beforeSend: 
        function(){         
            $("#msg_result").html("Please wait.....");  
        },             
        success: function(msg){
            $("#msg_result").html("Sent...");
        },

}); }

getMessage.php

$ch = curl_init("http://testxyz.com?user=xyz&password=xyz&mob=xyz&sid=xyz&msg=xyz");

curl_exec($ch);

curl_close($ch);

Any suggestion please.

Thanks In advance.

  • 写回答

0条回答 默认 最新

    报告相同问题?