I have a problem with cURL(I also tried it with file get content?). My starting point is a webserver that supplies me with an CSV file. To get the CSV file I've got to post some data to it (login details)
I have the following script already:
$url ='https://services.easyposonline.nl/i-shop/services/exporter/csv/artikelen.csv';
$httpRequest = curl_init();
curl_setopt($httpRequest, CURLOPT_RETURNTRANSFER, true);
curl_setopt($httpRequest, CURLOPT_HTTPHEADER, array("Content-Type: text/csv"));
curl_setopt($httpRequest, CURLOPT_POST, true);
curl_setopt($httpRequest, CURLOPT_HEADER, true);
curl_setopt($httpRequest, CURLOPT_URL, $url);
curl_setopt($httpRequest, CURLOPT_POSTFIELDS, $data);
$returnHeader = curl_exec($httpRequest);
print_r($returnHeader);
curl_close($httpRequest);
$data has my login detail for the post.
When posting this I get this back:
HTTP/1.1 100 Continue HTTP/1.1 200 OK Date: Wed, 11 Dec 2013 09:15:30 GMT Server: Apache X-Powered-By: PHP/5.4.21 Set-Cookie: PHPSESSID=rqse865bstv22vn9rdaefqvfg3; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache x-epsw-login: ok x-epsw-server: iepsw,version=V1.12.3.120911,user=ep_5757,app=i-shop,appid= Transfer-Encoding: chunked Content-Type: text/plain ||||||||||||||||| 4000270017|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||00|1|4000|0|||v000270.jpg|4|19990929| 4000270025|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||01|1|4000|0|||v000270.jpg|0|19990929| 4000270033|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||02|1|4000|0|||v000270.jpg|0|19990929| 4000270041|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||30|1|4000|0|||v000270.jpg|0|19990929| 4000270059|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||06|1|4000|0|||v000270.jpg|0|19990929| 4000270067|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||07|1|4000|0|||v000270.jpg|2|19990929| 4000270075|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||15|1|4000|0|||v000270.jpg|0|19990929| 4000270083|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||16|1|4000|0|||v000270.jpg|0|19990929| 4000270091|00800|4-20* Toilettasje|4-20* Toilettasje|0|Berba|4-020||17|1|4000|0|||v000270.jpg|0|19990929|
How to retrieve the webpage as a valid CSV mimetype file?