TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to Make Async Requests in PHP

34 点作者 calvinfo超过 12 年前

4 条评论

nodesocket超过 12 年前
Sorry if I am misunderstanding, but why not use Gearman (<a href="http://gearman.org/" rel="nofollow">http://gearman.org/</a>). We wrote a nice blog post on how we use Gearman for tracking API requests to Mixpanel <a href="http://blog.nodesocket.com/how-we-tracking-api-requests-with-mixpanel-an" rel="nofollow">http://blog.nodesocket.com/how-we-tracking-api-requests-with...</a>).<p>Or, use React (<a href="http://reactphp.org/" rel="nofollow">http://reactphp.org/</a>) a PHP async library.
评论 #5168129 未加载
评论 #5167198 未加载
pilif超过 12 年前
Forking seems like a very expensive solution to the problem. Especially in php where exec() doesn't actually do what exec in unix does in general (contrary to plain exec which you'd use after a fork, PHP's exec still runs a shell).<p>If you use their API even just one time per request, be aware that they will fork, execute a shell, fork again and then execute curl. Imagine where this is going when you use multiple API calls per request.<p>As this is "just" about analytics, why not use a UDP packet or two? Sure - they might not get delivered, but is that really so bad for analytics? Sending out a UDP package is very fast and there will be no waiting going on at all.
评论 #5167104 未加载
评论 #5167083 未加载
colinsidoti超过 12 年前
Happy to see you got PHP running, I imagine the next step is a Wordpress Plugin to handle it automatically.<p>I suspect that you'll frequently need to fallback to the socket approach. I imagine a lot of shared hosts block the capability to run exec (Godaddy, Hostgator, other common php hosts), and I believe that's where a lot of PHP lives.
评论 #5167107 未加载
jwmoz超过 12 年前
curl_multi???!!!