1

I have a script which generates an RSS feed, I call the script from cron and it generates an XML file.

What I would like to do is write a single script that I can call from cron, but that script in turn calls multiple scripts which generates multiple RSS feeds.

I tried doing:

<?php
  include('delicious-tags.php');
  include('delicious-user.php');    
?>

But I get the error:

<b>Fatal error</b>:  Cannot redeclare file_get_html() (previously declared in /home/danvelox/public_html/simple_html_dom.php:65) in <b>/home/public_html/simple_html_dom.php</b> on line <b>80</b><br />

Any ideas?

3 Answers 3

3

Change every instance of including/requiring simple_html_dom to include_once / require_once.

This will keep PHP from trying to re-include the whole library and attempting to redefine all the functions.

Sign up to request clarification or add additional context in comments.

Comments

2

It seems the same function is defined in both files. PHP doesn't like it when this happens.

If the function does the same thing move it to a seperate file.

If this function is declared in other files included by the files you are including it means there is a flaw in your including structure. While you could just use include_once or require_once it really means that you should probably move the inclusion of the library files to a higher level file so they don't collide in the first place.

Comments

1

Use exec.

exec("php-cli delicious-tags.php");
exec("php-cli delicious-user.php");

1 Comment

If it's a cron, it's already using PHP CLI (at least, it should)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.