Board logo

标题: PHP源码,让163网易相册QQ相册里的照片也能外链 调用防盗连图片 [打印本页]

作者: idc886    时间: 2009-5-21 17:14     标题: PHP源码,让163网易相册QQ相册里的照片也能外链 调用防盗连图片

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

今天又做了一个破解163网易相册/QQ相册/sohu相册等在线小工具,用起来也不错。

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

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


注:推荐使用第一种方法,163、QQ都有效。
      第2种方法,好像失效了。或是可能哪里出问题了。


PHP源码1:
<?php
if(substr($_GET['url'], 0, 7)!="http://"){
exit;
}
readfile($_GET['url']);
?>





PHP源码2:

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










★ 用法:把以上代码,存为一个 PHP文件,如:163.php

★ 使用方法:
本贴隐藏内容,需登录、回复后,即可浏览!


★ 显示:






以下ASP方式也是一样的用法:


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)<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
%>
<%
'形如
'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
%>
作者: hitdog    时间: 2009-12-9 22:49

this is the good way to use end of 163 photo gallary
作者: seoqing    时间: 2010-1-15 16:43

同时也可以用FLASH的方式或其他语言程序来表达
模拟访问该页,即可正常访问该图片
作者: 夏筱羽    时间: 2010-8-17 01:57

看不懂該怎麼用~~
作者: idc886    时间: 2010-8-17 07:56

回复 4# 夏筱羽


    ★ 用法:把以上代码,存为一个 PHP文件,如:163.php


方法已添加到主贴中。
作者: 让我倾听    时间: 2012-1-28 21:47

卡下哈
作者: Rogue    时间: 2012-3-16 08:30

看看能用不
作者: shenw    时间: 2012-7-25 20:11

试试去.........




欢迎光临 免费国外空间,国外免费空间, (http://idc866.com/) Powered by Discuz! 7.2