目前本站FB订阅图标的显示服务申请已经停止,但是作为一个负责的男人,我会一直保留以前的申请的图标继续显示的,除非不可抗拒的因素产生,俗话说,授人鱼不如授人以渔,所以对于虚拟主机abroad的兄弟,下面的这段代码或许对你有用。当然啊,你也别担心麻烦,后面会提供源代码的下载和使用方法
- < ?php
- $feedburner_image ="http://feeds.feedburner.com/~fc/storydaycom?bg=99CCFF&fg=444444&anim=0";//图片的路径
- //
- //下面的两个函数来自php.net
- //函数的作用是利用socks获取http内容
- //
- function httpSocketConnection($host, $method, $path, $data)
- {
- if ($method == "GET")
- {
- $path.= '?'.$data;
- }
- if (!$filePointer)
- {
- return false;
- }
- $requestHeader = $method." ".$path." HTTP/1.1\r\n";
- $requestHeader.= "Host: ".$host."\r\n";
- $requestHeader.= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n";
- $requestHeader.= "Content-Type: application/x-www-form-urlencoded\r\n";
- if ($method == "POST")
- {
- }
- $requestHeader.= "Connection: close\r\n\r\n";
- if ($method == "POST")
- {
- $requestHeader.= $data;
- }
- $responseHeader = '';
- $responseContent = '';
- do
- {
- }
- {
- {
- }
- }
- else
- {
- {
- $responseContentChunk = '';
- $read_length = 0;
- while ($read_length < $chunk_length)
- {
- }
- $responseContent.= $responseContentChunk;
- }
- }
- }
- function parseChunked($response) {
- $do = true;
- $return = "";
- $size = NULL;
- while($do) {
- // suppress warnings w/ @ if offset not in string (past end)
- if(!($pos === false) && $size === NULL) {
- // we found CRLF, get len from hex
- // get the actual chunk-len, reset $response, $size
- $size = NULL;
- }
- else {
- $do = false;
- } // end if/else
- } // end while
- return $return;
- } // end function parseChunked()
- require "date.php";//存放上次获取图标的时间
- //如果相距上次获取图标的时间超过了4小时
- //则更新图标
- //reload the image every 4 hours
- $phpstr = "";
- $contents = httpSocketConnection('feeds.feedburner.com', "GET", $http_get_path, $qString);
- //write image file
- //将图标写入文件中
- //同时更新本次获取图标的时间
- }
- ?>
代码在这里
fb.zip
请将fb.php用记事本打开,修改顶部$feedburner_image 的路径为你要转发图片的路径
然后将其他两个文件的属性设置成0666,最后在需要引用图片的地方引用fb.php的路径即可。
利用同样的原理大家也可以轻松的解决ajax http的跨域处理问题,不明白这一行在说什么的,忽略这一行。
该日志未加标签
前2排已经被占据了 快抢好位置哦
看不懂。高手。
我用的是 libcurl,只写了几行就可以了。而且 libcurl 的效率也不低。另外 bluehost 好像支持 curl 吧。[r]不错,curl是最好的选择,包括以前做缓存的时候都是用的这个东西,但是考虑到n多服务器没有这个lib,也考虑到n多服务器不支持fopen url,所以就用了这个socksopen,反正已经缓存,效率已经无所谓[/r]