// Returns array with headers in $response[0] and body in $response[1] function http_post($request, $host, $path, $port = 80, $ip=null) { $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n"; $http_request .= "Content-Length: {$content_length}\r\n"; $http_request .= "User-Agent: {$akismet_ua}\r\n"; $http_request .= "\r\n"; $http_request .= $request; $response = ''; if( false != ( $fs = @fsockopen( $http_host, $port, $errno, $errstr, 10 ) ) ) { fwrite( $fs, $http_request ); while ( !feof( $fs ) ) $response .= fgets( $fs, 1160 ); // One TCP-IP packet fclose( $fs ); $response = explode( "\r\n\r\n", $response, 2 ); } return $response; }
详细解决方案
应用php模拟http请求
热度:278 发布时间:2012-09-08 10:48:07.0
相关解决方案
- struts HTTP Status 500解决办法
- httpclient老是提示java.lang.NoSuchMethodError: org.apache.http.protocol.BasicHttpCon
- 启动tomcat后,http://localhost:8080无法打开的有关问题
- 相干tomcat HTTP Status 500的疑问,麻烦大家进来看看
- Web Service 错误:服务器未能识别 HTTP 头 SOAPAction 的值: http://tempuri.org/
- HTTP Status 404 - /jspdemo/Register.jsp,该怎么解决
- 'http://reg.163.com/login.jsp?type=1&url=http://entry.mail.163.com/coremail/fcg/,该如何处理
- org.apache.http.client.HttpClient与org.apache.commons.httpclient.HttpClient的差别
- HTTP 404有关问题
- myeclipse<%@ taglib prefix="c" uri="http://java.sun.com/jst1/core_rt"%>解决思路
- ,http 200状态码
- tomcat新手有关问题 HTTP Status 404 - /manager/
- java http 分段上载
- soap调用webservice,报错:Root element of a SOAP message must be: 'http://schemas.xmls,该怎么处理
- HTTP Status 404如何解决
- org.apache.tomcat.util.http.Parameters processParameters,该怎么解决
- 新手,HTTP Status 404 有关问题
- java http 断点上传,该如何处理
- JSP疑问<%@ taglib prefix="ht" uri="http://www.ht.com.cn/jsp/taglibs"%>该怎么处理
- weservice调用Server returned HTTP response code: 500 for URL解决方法
- HTTP Status 404 - /webproject2/servlet/login解决办法
- 报错:HTTP Status 405 - HTTP method GET is not supported by this URL解决思路
- http://newbbs.csdn.net/ 现时和老版的bbs用的还不是同一个库
- http://newbbs.csdn.net/ 现下和老版的bbs用的还不是同一个库
- Java.io.IOException: error 3 during http over WSP 这个是什么东东
- http://sourceforge.net这个网站是什么啊解决方案
- http 传送数据 每个包有大小限制码?解决办法
- Server returned HTTP response code: 403 for URL如何解决
- http://www.java-home.com重新下线,诚邀您的加入
- httpClient 错误 The server failed to respond with a valid HTTP response