isfak Posted November 25, 2016 Share Posted November 25, 2016 (edited) Hello! I am trying to download a CSV file with the following curl: $arrPostData = array('task' => 'download','selectedFields' => array('1', '2', '3') );curl_setopt($ch, CURLOPT_URL, $strURL);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arrPostData));$strCurlDownload = curl_exec($ch); This curl unfortunately does not produce anything (nor fails with curl_errno). Then I modify the $arrPostData array like that: $arrPostData = array('task' => 'download','selectedFields' =>'1'); This works, but then I only get field 1 in the output CSV file. How can I modify the curl to be able to get all fields 1,2,3? Thanks! Edited November 25, 2016 by isfak Quote Link to comment Share on other sites More sharing options...
requinix Posted November 25, 2016 Share Posted November 25, 2016 How does the service expect to receive multiple values of selectedFields? If it's not PHP style as "selectedFields[]=" then it's probably the more traditional style of using multiple "selectedFields=", which you'd have to build by-hand as PHP doesn't have a native function to do it for you. curl_setopt($ch, CURLOPT_POSTFIELDS, "task=download&selectedFields=1&selectedFields=2&selectedFields=3"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.