Posting multidimensional array with PHP and CURL

前端 未结 8 2048
难免孤独
难免孤独 2020-11-27 06:29

I\'m having trouble posting form data via CURL to a receiving PHP script located on a different host.

I get an Array to string conversion error

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 06:55

    I think you'll need to pass the options as a string:

    curl_setopt($this->ch, CURLOPT_POSTFIELDS, 'name[]=Jason&name[]=Mary&name[]=Lucy...');
    

    You should then be able to set the header manually via CURLOPT_HTTPHEADER.

提交回复
热议问题