XML 파싱 오류 : 시스템 또는 공개, URI가 누락되었습니다 [폐쇄

StackOverflow https://stackoverflow.com/questions/154310

  •  03-07-2019
  •  | 
  •  

문제

다음 URL에서 RSS 피드를 구문 분석하고 있습니다.

http://rss.sciam.com/scientificamerican-global?format=xml

// $xml_text is filled with the contents read from the URL
$xml_parser = xml_parser_create();
$res = xml_parse($xml_parser, $xml_text);

if (!$res) {
  $error =
    xml_error_string(xml_get_error_code($xml_parser)).
    " at line ".
    xml_get_current_line_number($xml_parser);
}

// $error contains: "SYSTEM or PUBLIC, the URI is missing at line 1"

FeedValidator.org 이것은 좋은 피드라고 말합니다.

PHP의 XML 파서 가이 오류를 해결하도록하려면 어떻게해야합니까?

편집하다: 사용자 에이전트를 기준 으로이 피드를 다른 위치로 리디렉션하는 것처럼 보입니다. 내 PHP 스크립트가 올바른 피드를 얻지 못하고 있습니다.

도움이 되었습니까?

해결책

코드는 저에게 효과적입니다. 텍스트를 잘못 이해해야합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top