PHP cURL HTTP PUT

后端 未结 4 781
一生所求
一生所求 2020-11-28 04:45

I am trying to create a HTTP PUT request with cURL and I can\'t make it work. I\'ve read many tutorials but none of them actually worked. Here\'s my current code:

         


        
4条回答
  •  春和景丽
    2020-11-28 05:07

    In a POST method, you can put an array. However, in a PUT method, you should use http_build_query to build the params like this:

    curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $postArr ) );
    

提交回复
热议问题