CURL 404错误。关于ajax功能

时间:2017-05-22 14:00:45

标签: php curl

PHP:

$url = "http://www.smsidea.co.in/sendsms.aspx?mobile=9427362750&pass=***&senderid=SMSWEB&to=".$data['mobile']."&msg=".$data['message']."";
$options = array(
    CURLOPT_RETURNTRANSFER => true,   // return web page
    CURLOPT_HEADER         => false,  // don't return headers
    CURLOPT_FOLLOWLOCATION => true,   // follow redirects
    CURLOPT_MAXREDIRS      => 10,     // stop after 10 redirects
    CURLOPT_ENCODING       => "",     // handle compressed
    CURLOPT_USERAGENT      => "test", // name of client
    CURLOPT_AUTOREFERER    => true,   // set referrer on redirect
    CURLOPT_CONNECTTIMEOUT => 120,    // time-out on connect
    CURLOPT_TIMEOUT        => 120,    // time-out on response
); 
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content  = curl_exec($ch);
curl_close($ch);

的Ajax:

$.ajax({
          type: "POST",
          url: "http://www.kakaproperty.com/Property/send_message",
          data: data,
          success: function(response){
            alert(response);
          }
        })

输出:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>

我正在使用带有ajax功能的CRUL。但它返回错误400错误请求任何人都可以请帮助我如何解决此错误。

0 个答案:

没有答案