当前位置:首页>>开发编程>>ASP>>新闻内容
让163网易相册QQ相册里的照片也能外链
作者: 发布时间:2007-12-5 12:26:52 文章来源:西部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处理方法
·ASP快速获取远程文件大小的方
·用ASP屏蔽迅雷和旋风下载工具
·解决ASP中传送中文参数乱码的
·ASP+AJAX做类似Google的搜索
·ASP的一个非常棒的Debug类(
·ASP中常用的服务器检测源代码
·优化ASP中执行SQL效率的五个
·ASP种msxml3.dll 800c0005错
·挂QQ的ASP版本网页源代码
相关信息
·数据库被挂马的ASP处理方法
·ASP快速获取远程文件大小的方法
·用ASP屏蔽迅雷和旋风下载工具的P2P下载
·解决ASP中传送中文参数乱码的问题
·ASP+AJAX做类似Google的搜索提示
·ASP的一个非常棒的Debug类(VBScript)
·ASP中常用的服务器检测源代码
·优化ASP中执行SQL效率的五个方法
·ASP种msxml3.dll 800c0005错误的另一解决方法
·挂QQ的ASP版本网页源代码
 画心
 愚爱
 偏爱
 火苗
 白狐
 画沙
 犯错
 歌曲
 趁我
 稻香
 小酒窝
 狮子座
 小情歌
 全是爱
 棉花糖
 我知道
 钻石糖
 Nobody
 我爱他
 套马杆
 星空物语
 最后一次
 少女时代
 穿越人海
 断桥残雪
 美了美了
 明天过后
 我很快乐
 到了明天
 心痛2009
 爱丫爱丫
 寂寞好了
 敢不敢爱
 郎的诱惑
 爱情买卖
 super girl
 我叫小沈阳
 i miss you
 姑娘我爱你
 我们都一样
 其实很寂寞
 习惯了寂寞
 我要的飞翔
 我的好兄弟
 爱的华尔兹
 李雷和韩梅梅
 贝多芬的悲伤
 爱我就跟我走
 丢了幸福的猪
 我只是个传说
 要嫁就嫁灰太狼
 即使知道要见面
 如果我变成回忆
 看得最远的地方
 斯琴高丽的伤心
 别在我离开之前离开
 不是因为寂寞才想你
 爱上你等于爱上了错
 在心里从此永远有个你
 一个人的寂寞两个人的错