Php 向uservoice发送JSON请求

Php 向uservoice发送JSON请求,php,jsonp,uservoice,Php,Jsonp,Uservoice,我目前正在使用一个联系我们表单,将用户信息发送到uservoice。我使用jquery代码向uservoice发送json请求 代码如下: $('#test_form').submit(function(evt) { evt.preventDefault(); var uvSubdomain = "initech";/ var uvKey = "5JVoVrAGdl4pMkcEkIeIDA"; var message = $('#mess

我目前正在使用一个联系我们表单,将用户信息发送到uservoice。我使用jquery代码向uservoice发送json请求

代码如下:

$('#test_form').submit(function(evt) {

    evt.preventDefault();  



    var uvSubdomain = "initech";/



    var uvKey = "5JVoVrAGdl4pMkcEkIeIDA";




    var message = $('#message').val();

    var subject = $('#subject').val();

    var name = $('#name').val();

    var email = $('#email').val();



    $.jsonp({

        url: 'https://' + uvSubdomain + '.uservoice.com/api/v1/tickets/create_via_jsonp.json\\?callback=?',

        data: {

            client: uvKey,
            ticket: {
                message: message,
                subject: subject
            },
            name: name,
            email: email
        },

        success: function(data) {

            alert('Successfully submitted ticket!');  // You might want to redirect the user here, or show a stylized message to them.

        },

        error: function(d, msg) {

            alert("Error"); 

        }

    });

    return false;
});

现在我想在PHP的帮助下发送json请求

如果您对此有任何建议或代码,请告诉我


谢谢

您可以使用卷曲扩展:

$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'https://test.com');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, 'name1=value1&name2=value2'); //post data
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($c);
curl_close($c);
如果连接到https站点,则必须添加以下内容之一:

//easy solution
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);

//secure solution
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($c, CURLOPT_CAINFO,"/path_to_certificate/cert.crt");

现在我想在PHP的帮助下发送json请求。您的意思是希望响应作为json?此方法的替代方法??没有卷曲延伸,我们如何使用它??