PHP 多卷曲 - 找出特定卷曲句柄使用了什么代理
我将多重卷曲与匿名代理一起使用,并且我想在返回卷曲句柄后根据性能和位置等标记代理。我尝试过curl_getinfo(),但它不会返回有关用于该curl 句柄的代理的信息。
有什么想法吗?我考虑过一种可能的方法来识别特定句柄并将其与所使用的代理一起存储,然后当句柄触发并通过curl_multi_info_read()返回时,我可以通过代理查找句柄。但不确定使用什么作为标识符。进行转储将句柄显示为资源(20),但不确定这是否是我可以依赖的东西?
我想如果有像 getOpt() 这样的东西会是理想的,但从我所做的研究中我没有看到类似的卷曲手柄。
I'm using multi curl with anonymous proxies, and I want to flag the proxies based on performance and location etc after the curl handle is returned. I've tried curl_getinfo() but that does not return information about the proxy used for that curl handle.
Any ideas? I've thought about maybe a way to identify a particular handle and storing that with the proxy used, then when the handle has fired off and returned via curl_multi_info_read() I can look up the handle via the proxy. Not sure what to use as an identifier though. Doing a dump shows the handle as resource(20), but not sure if that is something I can rely on?
I guess if there was something like getOpt() would be ideal, but i don't see anything like that for a curl handle from the research I have done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查 MultiRequest 库的最新版本。在那里你可以做这样的事情:
Check last version of MultiRequest library. There you can do something like this:
我发现了一个并行的curl类(由Pete Warden编写),它使用以下方法传递多curl的数据。
当多curl完成时,它能够使用curl句柄通过未完成的请求数组来保存信息。如果您对多卷曲感兴趣,请查看该课程,它为您设置了一切,并且非常可定制。
I found a parallel curl class (by Pete Warden), that passes data for multi-curl using the following..
When the multi-curl is done, it's able to use the curl handle to hold information via the outstanding requests array. If you're interested in multi-curl check out the class, it sets up everything for you and is very customizable.