Jump to content

Recommended Posts

I have been trying to find a way to add a atom feed and a xsl style file into a php file.

I have searched and searched and can not find anything.

 

The atom feed:

http://www.weather.gov/alerts-beta/al.atom

 

The xsl style sheet:

http://www.alabamaweather.org/rss/capatom.xsl

 

somehow both of those need to go into a php file i.e. warn.php

 

I have tried but keep getting an error.

 

 

Thanks,

Kenny

Link to comment
https://forums.phpfreaks.com/topic/152503-solved-atom-php/
Share on other sites

OK. I got half of this working.

 

Here is the script that is half complete:

 

<?php

- xsl line -

$homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0');

echo $homepage;

?>

 

I need to add the xsl line in the php script:

<?xml-stylesheet href='capatom.xsl' type='text/xsl'?>

however I cant just add that under <?php

 

Any ideas on how to include this??

 

Link to comment
https://forums.phpfreaks.com/topic/152503-solved-atom-php/#findComment-801029
Share on other sites

Just echo it above the other echo...

 

It didnt work:

 

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home2/alabamaw/public_html/rss/test2.php on line 3

 

<?php

$homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0');

echo '<?xml-stylesheet href='capatom.xsl' type='text/xsl'?>';

echo $homepage;

?>

Link to comment
https://forums.phpfreaks.com/topic/152503-solved-atom-php/#findComment-801267
Share on other sites

You cannot have a single quote within a single quote delimited string without escaping it.

 

If this is what your talking about I tired it and still got an error.

 

<?php

$homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0');

echo '\<?xml-stylesheet href=\'capatom.xsl\' type=\'text/xsl\'?\>';

echo $homepage;

?>

Link to comment
https://forums.phpfreaks.com/topic/152503-solved-atom-php/#findComment-801292
Share on other sites

Looks like you solved this but, you didn't mark it [sOLVED] so...

 

You can use single quotes for attributes inside a double quoted string:

 

$homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0');
echo "";
echo $homepage;
?>

Link to comment
https://forums.phpfreaks.com/topic/152503-solved-atom-php/#findComment-801879
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.