|
achilles - 2007-08-13 12:52:21
I produced a version of rss_example.php for my site (say 'rss-mysite.php') made sure the destination url for the output was entered
$rss_writer_object->about='http://www.mysite.com/mysite-test.xml';
and loaded it, together with
rss1html.xsl
rss2html.xsl
rss_writer_class.php
xmlwriterclass.php
into a folder (RSS) on my server. As a test, I chmodded the folder 'RSS' and the php files to 777, and then ran the file direct in Firefox. It not only ran, but rendered. However, it did not create the xml file http://www.mysite.com/mysite-test.xml
Now I don't handle php daily, but I cannot see what I have done wrong. I have double checked that the destination URL is written correctly. Have you any suggestions?
achilles - 2007-08-13 13:36:16 - In reply to message 1 from achilles
When viewing the source code of the rendered page, what I see is the xml file I require.
So I can copy that and upload the xml file by ftp. Is there no way the file can be generated and loaded automatically?
achilles - 2007-08-13 14:48:40 - In reply to message 2 from achilles
OK, I thought I'd try brutal
Towards the end of the file, I ameended
Header('Content-Type: text/xml; charset="'.$rss_writer_object->outputencoding.'"');
Header('Content-Length: '.strval(strlen($output)));
echo $output;
to read
Header('Content-Type: text/xml; charset="'.$rss_writer_object->outputencoding.'"');
Header('Content-Length: '.strval(strlen($output)));
echo $output;
$myFile = "http://mysite.com/mysite-test.xml";
$fh = fopen($myFile, 'w') or die("can't open rss file");
fwrite($fh, $output);
fclose($fh);
I created http://mysite.com/mysite-test.xml and set chmod to 777
still no joy
achilles - 2007-08-14 07:19:15 - In reply to message 3 from achilles
Well, one way around it was to make the xml file consist of a php include - and set up htacess so tha the file was parsed as xml. Only to find that IE7 did not like the format.
I am giving up on this one. However, all this has inspired me to write my own coding specific for my need.
Manuel Lemos - 2007-08-16 22:43:35 - In reply to message 1 from achilles
The XML writer class only returns the RSS feed as a whole string. If you want to generate it and store in a file, just take the RSS feed string and store it in a file with PHP function like file_put_contents.
achilles - 2007-09-07 23:33:47 - In reply to message 5 from Manuel Lemos
Manuel,
I am still new at understanding and handling classes. I overcame my immediate problem by adapting another class which does my job. Even so, I will follow up on your reply for my own education. Thanks for taking the trouble to reply.
Jesus Briones - 2011-10-07 13:50:36 - In reply to message 6 from achilles
all you need to do is add this
//name of the xml file
$file = 'channels.xml';
// Write the contents back to the file
file_put_contents($file, $output);
final result:
if($rss_writer_object->writerss($output))
{
/*
* If the document was generated successfully, you may now output it.
*/
Header('Content-Type: text/xml; charset="'.$rss_writer_object->outputencoding.'"');
Header('Content-Length: '.strval(strlen($output)));
//name of the xml file
$file = 'channels.xml';
// Write the contents back to the file
file_put_contents($file, $output);
echo $output;
}
else
{
|