在 jQuery Ajax 中查找 GET 属性

Find GET Attribute in jQuery Ajax

我从网页获取数据,它有一个 jQuery Ajax 请求。它的方法是 GET 并且它有一些数据,我想知道如何使用 cURL-php.

发送请求

我做了 运行 curl 会话并使用 curl_setopt($ch,CURLOPT_POSTFIELDS,$datas) 发送数据 但是没有反应。

// $.ajax({type: 'GET', dataType: 'json', url : 'http://example.com/some', data: $('#media_form').serialize()})
// $('#media_form').serialize() = string=string&link=https%3A%2F%2Fexample.com

实际上我将数组中的#media_form 数据放入 cURL 的后域中,但实际上我什至不知道我应该如何发送请求。 我应该如何发送没有任何属性的 GET 数据?

GET 参数放在 URL,而不是 POST 字段。

所以应该是:

$url = 'http://example.com/some?string=string&link=https%3A%2F%2Fexample.com';

您可以使用 http_build_str() 函数从参数的关联数组构造查询字符串。