Glype 프록시가 있는데 외부 URL을 구문 분석하지 않습니다. 페이지의 모든 URL은 http://proxy.com/browse.php?u=[URL 여기에으로 자동 변환됩니다. 예 : 그래서, 물론Preg-replace - 도메인과 하위 도메인을 제외한 모든 URL을 바꿉니다.
ByteLove.com (Not to: http://proxy.com/browse.php?u=http://bytelove.com&b=0)
BayFiles.com (Not to: http://proxy.com/browse.php?u=http://bayfiles.com&b=0)
BayIMG.com (Not to: http://proxy.com/browse.php?u=http://bayimg.com&b=0)
PasteBay.com (Not to: http://proxy.com/browse.php?u=http://pastebay.com&b=0)
Ipredator.com (Not to: http://proxy.com/browse.php?u=https://ipredator.se&b=0)
etc.
나는 내부 URL을 유지하려면 : 내 프록시에 해적 베이를 방문하면, 나는 다음과 같은 URL을 구문 분석하지 원하는
thepiratebay.se/browse (To: http://proxy.com/browse.php?u=http://thepiratebay.se/browse&b=0)
thepiratebay.se/top (To: http://proxy.com/browse.php?u=http://thepiratebay.se/top&b=0)
thepiratebay.se/recent (To: http://proxy.com/browse.php?u=http://thepiratebay.se/recent&b=0)
etc.
가 있는가 thepiratebay.se 및 하위 도메인 (예에서와 같이)을 제외한 모든 URL을 대체하기위한 preg_replace? 다른 기능도 환영합니다. (이러한 DOMDocument를, querypath, SUBSTR 또는 strpos로 나는 모든 URL을 정의해야하기 때문에 않는 str_replace하지 않습니다.) 내가 뭔가를 발견했습니다
,하지만 난 preg_replace이다 익숙하지 않다 :
$exclude = '.thepiratebay.se';
$pattern = '(https?\:\/\/.*?\..*?)(?=\s|$)';
$message= preg_replace("~(($exclude)?($pattern))~i", '$2<a href="$4" target="_blank">$5</a>$6', $message);
, 이것은 내 코드입니다 : http://pastebin.com/6ML8q7JN URL의 위치는 다음과 같습니다. $ document –
대구가 작동하는지 평가하기 위해 $ document 변수의 내용을 확인해야합니다. –
현재 작동하지만 URL 뒤에 _ & b = 0_이 있습니다. 그것을 고치는 방법? –