让163网易相册QQ相册里的照片也能外链

2010-08-28 10:52:45来源:西部e网作者:

现在很多相册都已经不能用外链了,比如常用的网易163相册、QQ相册、SOHU相册等等,甚至一些博客上传后的图片也不能用做外链,破解它的方法其实网上早就有了,但是很少看到有直接做成小工具让大家用的哈,这两天似乎做这类小工具上瘾了,每天都要做上一个,花不了几分钟时间,但是确十分有用哦~~~

今天又做了一个破解163网易相册/QQ相册/sohu相册等在线小工具,用起来也不错。
地址在:http://www.yiiwa.net/tools/pic.aspx

其实原理很简单,就是用一个中转的程序把图片度到cache里面,然后再显示出来,本来我也想放一个程序的,但是发现似乎占用的内存还不小,用的少还不怕,要是大家都用我可是收不了!

所以我把PHP和ASP的代码都给出来,以便以后谁用的上,代码不是我写的,我也是在网上找的哦~~~

PHP代码:

    $pics=file($p);
    for($i=0;$i    {
          echo $pics[$i];
    }
?>


ASP代码:
<%
'形如
'http://www.yiiwa.net/pic.asp?url=http://img.photo.163.com/-C9z6fC8-rzRRU4hymYcuQ==/753789987632211589.jpg

Dim url, body, myCache
On Error Resume Next

url = Request.QueryString("url")

Set myCache = new cache
myCache.name = "picindex"&url
If myCache.valid Then
body = myCache.value
Else
body = GetWebData(url)
myCache.add body,dateadd("d",1,now)
End If

If Err.Number = 0 Then
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite body
Response.Flush
Else
Wscript.Echo Err.Description
End if

'取得数据
Public Function GetWebData(ByVal strUrl)
Dim curlpath
curlpath = Mid(strUrl,1,Instr(8,strUrl,"/"))
Dim Retrieval
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", strUrl, False,"",""
.setRequestHeader "Referer", curlpath
.Send
GetWebData =.ResponseBody
End With
Set Retrieval = Nothing
End Function


'cache类
class Cache
private obj 'cache内容
private expireTime '过期时间
private expireTimeName '过期时间application名
private cacheName 'cache内容application名
private path 'url

private sub class_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
end sub

private sub class_terminate()
end sub

public property get blEmpty
'是否为空
if isempty(obj) then
blEmpty=true
else
blEmpty=false
end if
end property

public property get valid
'是否可用(过期)
if isempty(obj) or not isDate(expireTime) then
valid=false
elseif CDate(expireTime) valid=false
else
valid=true
end if
end property

public property let name(str)
'设置cache名
cacheName=str & path
obj=application(cacheName)
expireTimeName=str & "expires" & path
expireTime=application(expireTimeName)
end property

public property let expires(tm)
'重设置过期时间
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
end property

public sub add(var,expire)
'赋值
if isempty(var) or not isDate(expire) then
exit sub
end if
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
end sub

public property get value
'取值
if isempty(obj) or not isDate(expireTime) then
value=null
elseif CDate(expireTime) value=null
else
value=obj
end if
end property

public sub makeEmpty()
'释放application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
end sub

public function equal(var2)
'比较
if typename(obj)<>typename(var2) then
equal=false
elseif typename(obj)="Object" then
if obj is var2 then
equal=true
else
equal=false
end if
elseif typename(obj)="Variant()" then
if join(obj,"^")=join(var2,"^") then
equal=true
else
equal=false
end if
else
if obj=var2 then
equal=true
else
equal=false
end if
end if

end function
end class
%>

<% 
'形如
'http://www.yiiwa.net/pic.asp?url=http://www.yiiwa.net/" target="_blank" class="keylink">西部e网(yiiwa.net),谢谢!

关键词:ASP

赞助商链接: