How To Load Rss Into Php?

What types of code makes PHP code (in a header.php file) fail to load?

  • My PHP file works when I put isolated text in it. But it doesn't work when I put this code in it: "<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">   <head>   <meta http-equiv="content-type" content="text/html;charset=UTF-8" />   <title>Alex K Chen's Homepage</title>  <link href="astroparrot.css" type="text/css" rel="stylesheet" /> <link href="https://lh5.googleusercontent.com/-oLr1brwRpzw/AAAAAAAAAAI/AAAAAAAAAAA/xAt5ea9Y6OQ/photo.jpg" type="image/gif" rel="shortcut icon" /> "

  • Answer:

    That looks like a common problem caused by mixing PHP and XML. The PHP parser sees the <?xml tag and tries to parse its contents as PHP because it starts with <?, but the text immediately afterward is still XML so the parser throws an error. You can fix this by: disabling short_open_tag in php.ini, or having PHP print the XML tag, as below <?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>

Bulat Bochkariov at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.