如何使用PHP通过socket向其他web服务器发送POST请求?
- 内容介绍
- 文章标签
- 相关推荐
本文共计97个文字,预计阅读时间需要1分钟。
phpfunction post_request($url, $data, $referer='') { // 将数据数组转换为URL参数 $data=http_build_query($data);
// 解析给定的URL $url=parse_url($url);
// 检查URL方案是否为http if ($url['scheme'] !='http') { die('Error:'); }}
function post_request($url, $data, $referer='') { // Convert the data array into URL Parameters like a=b&foo=bar etc. $data = www.example.com/', $post_data); if ($result['status'] == 'ok'){ // Print headers echo $result['header']; echo '<hr />'; // print the result of the whole request: echo $result['content']; } else { echo 'A error occured: ' . $result['error']; }
本文共计97个文字,预计阅读时间需要1分钟。
phpfunction post_request($url, $data, $referer='') { // 将数据数组转换为URL参数 $data=http_build_query($data);
// 解析给定的URL $url=parse_url($url);
// 检查URL方案是否为http if ($url['scheme'] !='http') { die('Error:'); }}
function post_request($url, $data, $referer='') { // Convert the data array into URL Parameters like a=b&foo=bar etc. $data = www.example.com/', $post_data); if ($result['status'] == 'ok'){ // Print headers echo $result['header']; echo '<hr />'; // print the result of the whole request: echo $result['content']; } else { echo 'A error occured: ' . $result['error']; }

