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

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

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

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

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

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

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

'取得数据
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://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 

'取得数据 
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)<now then 
    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)<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 
%> 
注:转载请注明来源于西部e网(weste.net),谢谢!

关键词:ASP

赞助商链接:

忐忑
浮夸
说谎
倾世
王妃
煎熬
武装
小三
曾经
素颜
惊叹号
爱很美
春天里
老男孩
皮影戏
走天涯
羽绒服
甩葱歌
套马杆
伤不起
有没有
苦咖啡
追梦人
那些年
大声唱
爱的供养
三寸天堂
荷塘月色
喜欢寂寞
爱情买卖
爱是你我
见或不见
火力全开
一念执着
想你的夜
依然爱你
幸福额度
红尘情歌
明天你好
狼的诱惑
你是我的眼
没那么简单
客官不可以
等你的季节
等不到的爱
美丽与勇敢
我的好兄弟
我们的歌谣
如果爱忘了
梦中的额吉
男人帮片尾曲
最重要的决定
不分手的恋爱
魔鬼中的天使
裸婚时代插曲
当我唱起这首歌
全世界宣布爱你
请安静的忘记我
亲爱的你在哪里
天龙八部之宿敌
爱情睡醒了主题曲
漂亮的姑娘就要嫁人啦
最接近天堂的地方
我爱你胜过你爱我
下辈子做你的女人