如果您可以远程访问此文件,那么您应该使用HTTP API。
$response = wp_remote_request(
     \'http://xml.prisguide.no/productExport.php?productId=151690\'
    ,array(
        \'ssl_verify\' => true // If the request isn\'t working, try it with `false`
     )
);
 然后,您只需捕获响应并检查是否有错误:
if ( is_wp_error( $response ) )
    // don\'t expose error to other users than admin
    return current_user_can( \'manage_options\' ) ? $response->get_error_message() : \'\';
 然后你去提取内容。
$content = trim( wp_remote_retrieve_body( $response ) );
$content = new SimpleXMLElement( $content );
 现在,对检索到的数据执行任何需要的操作。