php下curl与file_get_contents性能对比
2015-04-05 00:00
465 查看
摘要: 很多是时候在程序中需要请求http,然而在php中有2种请求方式,1是用curl,2是file_get_contents,
经过自己测试 curl比file_get_contents速度快了30%左右,不过最重要的是服务器负载更低. file_get_contents用来读文件就行,不要用它来获取远程url得信息,走api之类得绝对不要考虑它,当然如果http请求过来的文件中包含xml格式等可以使用
这样就可以得到请求的body中的xml信息。
经过自己测试 curl比file_get_contents速度快了30%左右,不过最重要的是服务器负载更低. file_get_contents用来读文件就行,不要用它来获取远程url得信息,走api之类得绝对不要考虑它,当然如果http请求过来的文件中包含xml格式等可以使用
$xml = file_get_contents('php://input');
这样就可以得到请求的body中的xml信息。
相关文章推荐
- php下curl与file_get_contents性能对比
- php下curl与file_get_contents性能对比
- php读取网络文件(curl, fsockopen ,file_get_contents 几个方法的效率对比)
- php中file_get_contents与curl性能比较分析
- PHP中file_get_contents于curl性能效率比较
- php中file_get_contents与curl性能比较分析
- php中file_get_contents与curl性能比较分析
- php中file_get_contents与curl性能比较分析
- php读取网络文件 curl, fsockopen ,file_get_contents 几个方法的效率对比
- php中file_get_contents()与curl()性能比较
- PHP加载大文件时require和file_get_contents的性能对比
- php读取网络文件 curl, fsockopen ,file_get_contents 几个方法的效率对比
- php中file_get_contents与curl性能比较分析
- php读取网络文件 curl, fsockopen ,file_get_contents 几个方法的效率对比
- php中file_get_contents与curl性能比较分析
- php读取网络文件 curl, fsockopen ,file_get_contents 几个方法的效率对比
- php中file_get_contents与curl性能比较分析
- php中file_get_contents与curl性能比较分析
- php读取网络文件 curl, fsockopen ,file_get_contents 几个方法的效率对比
- php采用file_get_contents代替使用curl实例