CI 묻고 답하기

제목 CI질문은 아닌데 혹시 아시는분.. 특정 RSS 페이지를 불러오지 못합니다..;
글쓴이 터프키드 작성시각 2009/08/06 18:47:45
댓글 : 4 추천 : 0 스크랩 : 0 조회수 : 32909   RSS
라는 주소인데요
php에서 기존 개발자가 RSS Reader를
fopen 으로 만들어뒀는데, 해당 호스팅 서버에서 allow_url_fopen 을 off 시켜놓은거 같아요
그래서 fsockopen 으로 해도 
도메인(www.urin79.com)까지는 성공하긴 하는데요
www.urin79.com/rss 이건 계속
 
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/pressb35/new_rss_reader.php on line 42
 
Warning: fsockopen() [function.fsockopen]: unable to connect to http://urin79.com/rss:80 in /home/pressb35/new_rss_reader.php on line 42
 
이렇게 뜹니다..ㅠㅠ
 
php 5라서 set_ini 인가로 fopen을 풀수도 없다는데
올블로그 에서는 저 주소 넣으면 등록이 되거든요..
믹시에서는 또 안되고.. 정확하지 않은 URL 이라고요..
(메타블로그 들도 다 다름..ㅡㅡ;)
 
어떻게하면 불러올수있을까요;
스트레스 이빠이입니다ㅠㅠ
 다음글 한글 메뉴얼 다운로드 안되는가요? (3)
 이전글 공통 함수 위치. (4)

댓글

마냐 / 2009/08/06 19:05:40 / 추천 0

해당 오류는 fsockopen 의 $host 에 http:// 를 붙이면 나오는군요.

제로보드XE RSS 같은데 다른 곳은 되던데..
설정 문제인가..

HTTP/1.0 404 Not Found
Date: Thu, 06 Aug 2009 10:04:13 GMT
Server: Apache
X-Powered-By: PHP/5.2.4
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Status: 404 Not Found
Content-Length: 203
Connection: close
Content-Type: text/html; charset=iso-8859-1

Not Found
Something is wrong with your request!

ci세상 / 2009/08/06 22:22:26 / 추천 0
<?
function SocketPost($host, $target, $posts, $port = 80) { 
    if( is_array($posts) ) { 
        foreach( $posts AS $name => $value ) 
        $postValues .= urlencode($name)."=".urlencode( $value )."&"; 
        $postValues = substr($postValues, 0, -1); 
    } 
     
    $postLength = strlen($postValues); 

    $request  = "POST $target HTTP/1.1\r\n"; 
    $request .= "Host: $host\r\n"; 
    $request .= "User-Agent: Mozilla/4.0\r\n"; 
    $request .= "Accept: text/xml,application/xml,application/xhtml+xml,"; 
    $request .= "text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,"; 
    $request .= "image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1\r\n"; 
    $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
    $request .= "Content-Length: ".$postLength."\r\n"; 
    $request .= "Connection: close\r\n"; 
    $request .= "\r\n"; 
    $request .= $postValues; 
    $socket  = fsockopen($host, $port, $errno, $errstr, 100); //1966라인 
    fputs($socket, $request); 

    $ret = ""; 
    while( !feof($socket) ) $ret .= fgets( $socket, 4096 ); 
    fclose( $socket ); 
    return $ret; 
}

$host = "urin79.com"; 
$target = "/rss"; 

$rss_var = SocketPost($host, $target, $_array);

echo "$rss_var";
?>
php.ini에서

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = off

끄고 해보았습니다.^^
터프키드 / 2009/08/07 08:55:05 / 추천 0
CI세상님 정말 감사드려요ㅠㅠ
밤늦게까지...
좀있다가 적용해보고 결과 말씀드릴께요^^!

터프키드 / 2009/08/10 13:39:41 / 추천 0
 ci세상님 완전 실력자십니다;
잘되네요! 감사합니다(__)