讓163網(wǎng)易相冊(cè)QQ相冊(cè)里的照片也能外鏈

2010-08-28 10:52:45來(lái)源:西部e網(wǎng)作者:

現(xiàn)在很多相冊(cè)都已經(jīng)不能用外鏈了,比如常用的網(wǎng)易163相冊(cè)、QQ相冊(cè)、SOHU相冊(cè)等等,甚至一些博客上傳后的圖片也不能用做外鏈,破解它的方法其實(shí)網(wǎng)上早就有了,但是很少看到有直接做成小工具讓大家用的哈,這兩天似乎做這類小工具上癮了,每天都要做上一個(gè),花不了幾分鐘時(shí)間,但是確十分有用哦~~~

今天又做了一個(gè)破解163網(wǎng)易相冊(cè)/QQ相冊(cè)/sohu相冊(cè)等在線小工具,用起來(lái)也不錯(cuò)。
地址在:http://weste.net/tools/pic.aspx

其實(shí)原理很簡(jiǎn)單,就是用一個(gè)中轉(zhuǎn)的程序把圖片度到cache里面,然后再顯示出來(lái),本來(lái)我也想放一個(gè)程序的,但是發(fā)現(xiàn)似乎占用的內(nèi)存還不小,用的少還不怕,要是大家都用我可是收不了!

所以我把PHP和ASP的代碼都給出來(lái),以便以后誰(shuí)用的上,代碼不是我寫(xiě)的,我也是在網(wǎng)上找的哦~~~

PHP代碼:

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


ASP代碼:
<%
'形如
'http://weste.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

'取得數(shù)據(jù)
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內(nèi)容
private expireTime '過(guò)期時(shí)間
private expireTimeName '過(guò)期時(shí)間application名
private cacheName 'cache內(nèi)容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
'是否可用(過(guò)期)
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)
'設(shè)置cache名
cacheName=str & path
obj=application(cacheName)
expireTimeName=str & "expires" & path
expireTime=application(expireTimeName)
end property

public property let expires(tm)
'重設(shè)置過(guò)期時(shí)間
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://weste.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 

'取得數(shù)據(jù) 
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內(nèi)容 
private expireTime '過(guò)期時(shí)間 
private expireTimeName '過(guò)期時(shí)間application名 
private cacheName 'cache內(nèi)容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 
'是否可用(過(guò)期) 
  if isempty(obj) or not isDate(expireTime) then 
    valid=false 
  elseif CDate(expireTime)<now then 
    valid=false 
  else 
    valid=true 
  end if 
end property 

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

public property let expires(tm) 
'重設(shè)置過(guò)期時(shí)間 
  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)<now then 
    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 
%> 
注:轉(zhuǎn)載請(qǐng)注明來(lái)源于西部e網(wǎng)(weste.net),謝謝!

關(guān)鍵詞:ASP

贊助商鏈接: