PHP에서 file handler로 http, ftp등 넘겨줄 수 있는 거 다 아시죠?
가령 $fd=fopen("$DOCUMENT_ROOT/index.html","r"); 이라고 쓸 것을
$fd=fopen("http://xx.xx.x/index.html","r"); 이라고 해도 같죠.
차이가 있다면 전자는 file system으로 접근하고
후자는 http를 통해 접근함에 따른 속도차이(상당한 차이이긴 하지만..)정도.
str_replace와 fopen을 써서 모razyBoard를 바보만들어 봤습니다.
translate.altavista.co.kr이던가요.. (기억이..) 사이트 영한번역 서비스같은 것을 구현할때도 유용하겠지요?
fread로 긁어와서 광고가 나오는 부분을 잘라내는
소스입니다.
--------
<?
$filename="http://board5.free.cgiserver.net/CrazyWWWBoard.cgi?db=자신의db이름&page=1";
$fd = fopen ($filename, "r");
$contents = fread ($fd, 90000);
// 광고를 자르고
$contents = substr($contents, 0, strpos($contents,"<!-- USR BODY-BEGIN -->")-1)
.substr($contents, strpos($contents, "<!-- SYS CAPTION-->")+19);
// 상대경로로 되어있는 이미지들을 절대경로로 변환합니다.
$contents = str_replace("<img src=\"", "<img src=\"http://board5.free.cgiserver.net",$contents);
$contents = str_replace("<img src='", "<img src='http://board5.free.cgiserver.net",$contents);
$contents = str_replace("background=\"", "background=\"http://board5.free.cgiserver.net",$contents);
// 잘라내기 마무리..
$contents = substr($contents, 0, strpos($contents,"<!-- USR BODY-END -->")-1)
.substr($contents, strpos($contents, "<!-- SYS BODY-END -->")+21);
// 출력합니다.
echo($contents);
fclose ($fd);
?>