Fky Fky - 4 years ago 98
PHP Question

drupal_http_request , http->data add a string "2000" at randomly lines

I have a strange issue, i'm getting a huge CSV file from url with

drupal_http_request
:

$http = drupal_http_request($url, array('timeout' => 120.0));
file_put_contents(drupal_realpath('public://').'/httpdata.csv',$http->data);


i manage to handle it BUT when i deal with
http->data
i have some string "2000" who breaks lines :

2017-01-09,toto,tata,31
2017-01-09,toto,ti
2000
ti,34
2017-01-09,toto,tutu,36


[etc..]

When i'm getting csv from browser on direct download and open it into excel or notepad++ i didn't have string "2000", so i'm supposing
drupal_http_request
is guilty but i don't understand why ?!

Some kind of help is welcome !

Thank you !
Franck

Answer Source

(Posted on behalf of the OP).

I solved my issue replacing drupal_http_request by my own curl request and everything works perfectly!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download