file_get_contents高級用法
2014-09-24 09:38
183 查看
Set_time_out(0);//防止脚本超时
function Post($url, $post = null){
$context = array();
if (is_array($post)) {
ksort($post);
$context['http'] = array (
'timeout'=>60,
'method' => 'POST',
'content' => http_build_query($post, '', '&'),
);
}
return file_get_contents($url, false, stream_context_create($context));
}
$data = array (
'name' => 'test',
'email' => 'test@gmail.com',
'submit' => 'submit',
);
echo Post('http://www.example.com', $data);
function Post($url, $post = null){
$context = array();
if (is_array($post)) {
ksort($post);
$context['http'] = array (
'timeout'=>60,
'method' => 'POST',
'content' => http_build_query($post, '', '&'),
);
}
return file_get_contents($url, false, stream_context_create($context));
}
$data = array (
'name' => 'test',
'email' => 'test@gmail.com',
'submit' => 'submit',
);
echo Post('http://www.example.com', $data);
相关文章推荐
- PHP中file_get_contents高級用法实例
- PHP中file_get_contents高級用法实例
- PHP中file_get_contents高級用法实例
- file_get_contents高級用法实例
- file_put_contents以及file_get_contents的用法与在使用过程中遇到的问题(PHP学习)
- ob_get_contents();basename;file_get_contents用法
- php file_get_contents("php://input")的用法
- php使用Url读取文件的内容及file_get_contents用法
- fopen()和file_get_contents()打开URL获得网页内容的用法区别
- FileDialog::getOpenFileName()函数用法及FindDialog::FindDialog(QWidget *parent) :QDialog(parent)
- file_put_contents() 与 file_get_contents() 函数用法
- file_put_contents以及file_get_contents的用法与在使用过程中遇到的问题(PHP学习)
- php-file_get_contents取文件中数组元素的用法
- GetFileSizeEx 用法
- fopen()和file_get_contents()打开URL获得网页内容的用法区别
- php中的 file_get_contents(‘php://input’)用法
- File 方法中 getParentFile()的用法及作用
- GetModuleFileName 函数的用法
- 获取程序当前执行文件名-GetModuleFileName的用法
- fopen()和file_get_contents()打开URL获得网页内容的用法区别