duanke1984 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 ?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器