drwu24647 2013-06-16 23:17
浏览 43
已采纳

使用PHP从REST API和RSS异步获取数据

I'm currently rewriting my iOS app in PHP and I need to fetch data from an API and an RSS feed asynchronously. The reason that I want it to be async is because of speed. Because I need to make something like 20 requests, on iOS it happens much quicker if I make several requests at the same time and then gather the data as the responses come back.

This is how I did it in iOS:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    // fetch data here
    // completion code here
});

How do I achieve this in PHP? Is it even possible? I googled this and I found only a way to fire off a GET/POST request, but without fetching any data.

Thanks!

  • 写回答

1条回答 默认 最新

  • doufuhao8085 2013-06-24 01:42
    关注

    Found this great library which allows parallel async http requests:

    https://github.com/stil/curl-easy

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部