简体   繁体   English

drupal_http_request,http-> data在随机行添加字符串“2000”

[英]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 : 我有一个奇怪的问题,我正在使用drupal_http_request从url获取一个巨大的CSV文件:

$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: 我设法处理它但是当我处理http->data我有一些字符串“2000”打破了行:

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? 当我从浏览器直接下载csv并将其打开到Excel或Notepad ++时,我没有字符串“2000”,所以我drupal_http_request有罪,但我不明白为什么?

(Posted on behalf of the OP) . (代表OP发布)

I solved my issue replacing drupal_http_request by my own curl request and everything works perfectly! 我解决了我的问题,用我自己的curl请求替换drupal_http_request,一切都运行完美!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM