0

基本的にこれは検索バーであり、検索された用語を取得して API 呼び出し URL に入れますが、取得しています

警告: simplexml_load_file() [function.simplexml-load-file]: I/O 警告: 外部エンティティ "" のロードに失敗しました

何か案は?

コード:

if (!empty($_POST['searchbird'])){
    $searchbird=rawurlencode($_POST['searchbird']);
    $searchCode = "http://ebird.org/ws1.1/data/obs/region_spp/recent?rtype=subnational2&r=US-AZ-013&sci=$searchbird";
    $url_headers = @get_headers($searchCode);

    if($url_headers[0] == 'HTTP/1.1 200 OK') {
        $xml = simplexml_load_file($url);

        print_r($xml);

    } else {
        // Error
        echo $searchCode;
        print_r($url_headers);
        exit("failed to load XML");
    }


} else {
    $searchbird = '';
    $form = "<form method='post'>
       <strong>Enter the name of a Bird</strong>
       <input type='text' name='searchbird' value='$searchbird' />
       <input type='submit' name='submit' value='submit' />
    </form>";
    echo $form;
}
4

1 に答える 1