CURL vs fsockopen chunking

与世无争的帅哥 提交于 2019-12-07 07:47:36

问题


This may seem kind of weird.. but I need to evaluate/parse chunks being sent over HTTP with PHP.

It's of note to say that the HTTP stream may never end. Is there any way I can parse chunks as I get them with CURL?

Or do I have to resort to some home-brewed fsockopen() solution?


回答1:


Take a look at the option CURLOPT_WRITEFUNCTION. You can define a callback that will be called when there's new data in the response. See the manual.



来源:https://stackoverflow.com/questions/3350029/curl-vs-fsockopen-chunking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!