How to switch from POST to GET in PHP CURL

前端 未结 4 1662
-上瘾入骨i
-上瘾入骨i 2020-11-28 22:23

I have tried switching from a previous Post request to a Get request. Which assumes its a Get but eventually does a post.

I tried the following in PHP :



        
4条回答
  •  一生所求
    2020-11-28 23:03

    Solved: The problem lies here:

    I set POST via both _CUSTOMREQUEST and _POST and the _CUSTOMREQUEST persisted as POST while _POST switched to _HTTPGET. The Server assumed the header from _CUSTOMREQUEST to be the right one and came back with a 411.

    curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'POST');
    

提交回复
热议问题