2019-07-14 03:24
浏览 76

在jQuery Ajax中查找GET属性

I getting data from a Webpage and it have a jQuery Ajax Request. its Method is GET and it have some data, i wanna know how i can send request with cURL-php.

i did run a curl session and send data with curl_setopt($ch,CURLOPT_POSTFIELDS,$datas) but it didn't respond.

// $.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

actually i put #media_form data in an array into postfields in cURL, but in fact i even dont know how should i send request. how should i send data in GET without any Attribute ?

图片转代码服务由CSDN问答提供 功能建议

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

我确实运行了卷曲会话并使用 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中的postfields数组中,但事实上我甚至都不知道 我应该如何发送请求。 如何在没有任何属性的情况下在GET中发送数据?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dscs63759 2019-07-14 03:52

    GET parameters are put in the URL, not the POST fields.

    So it should be:

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

    You can use the http_build_str() function to construct the query string from an associative array of parameters.

    打赏 评论

相关推荐 更多相似问题