AskLink 提供了多种代码以供不同网站使用,其中WordPress安装是比较简单的,他提供了插件的功能,直接加上去就可以了,同样也提供了blogger 插件功能。

对于没有插件功能的博客可以自己添加代码,AskLink提供了PHP、ASP、JSP、Perl、Ruby等语言的代码内容,站长根据自身的博客进行添加代码吧。

立即注册AskLink开始赚美元

我给大家介绍一下sablog 2.0的安装方法:

修改modules\article.php ,在末尾?>前面添加以下代码

// *********************Ask2link Text 链接代码******************************
function ask2link_ad_helper($url)  
{  
  $content = '';  
  $done=false;  
  if (ini_get('allow_url_fopen') == '1') {  
    if ($fp = @fopen($url, 'r')) {  
      while ($line = @fread($fp, 1024)) {  
        $content .= $line;  
    $done=true;  
      }  
    }  
  }   
  if (!$done) {  
    // get the host name and url path  
    $parsedUrl = parse_url($url);  
    $host = $parsedUrl['host'];  
    if (isset($parsedUrl['path'])) {  
      $path = $parsedUrl['path'];  
    }  
      
    $timeout = 10;  
    // connect to the remote server   
    $fp = @fsockopen($host, '80', $errno, $errstr, $timeout );   
      
    if( !$fp ) {   
      // echo "Cannot retrieve $url";  
    } else {  
      // send the necessary headers to get the file   
      @fputs($fp, "GET $path HTTP/1.0" .  
        "Host: $host");   
        
      // retrieve the response from the remote server   
      while ( $line = @fread( $fp, 4096 ) ) {   
        $content .= $line;  
      }         
      @fclose( $fp );        
      // strip the headers  
      $pos      = strpos($content, "");  
      $content = substr($content, $pos + 4);  
    }  
  }  
      
  // return the file content   
  return $content;  
}  
 
function ask2link_ad($url) {  
  $h = urlencode($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);  
  $content=ask2link_ad_helper($url."?x-h=".$h);  
  if (!preg_match('/\<Error/',$content)) {  
    return $content;  
  } else
 {
  return "error";
 }
 
}  
 
$ask2link = ask2link_ad('http://s3.amazonaws.com/mf1/ad/你的密钥/ad_content'); 
// *********************END-----Ask2link Text 链接代码******************************

对应的修改一下“你的密钥”,在AskLink后台代码处可以看到这个密钥,有点类似MD5加密,呵呵。

添加好以后,修改模板文件normal.php,在友情链接下面添加输出代码就可以了。

<h2>AskLink</h2>
    $ask2link

大功告成,祝你多赚美元!

立即注册AskLink开始赚美元

Last modification:August 16, 2009
稀罕你