I am confused. What language is this file written in?
If it is in PHP all you need to do is put "<?php .............. ?>" tags around the scripting for it to execute everytime someone loads that page.
Any more information?
if you save the file with the extension .php, and put all the scripting within <?php .. ?> tags, then the file will be executed automatically...
The file should execute properly if you have given it the extension '.php' and have written it properly without any errors.
If you have done all this and yet it isn't executing then there's something wrong with your account's php which is most unlikely OR you are trying to open it straight from your control panel. Try typing the full URL and then see if it works.
It's working when a user is requesting it, but I want another php script to execute it.
Then you will have to use include() or require() [which is the same thing but with a stop error].
I'm not sure why you need to run the script "separately." Is it to preserve variable values? If it is the easiest way to convert your existing code so this doesn't happen would be to make the code on the included page into a function, with parameters for the variables you don't want to change.
You can then include the file, which just defines the function and doesn't execute it. Then directly after the include(), call the function as necessary. Functions have a separate memory space so shouldn't change anything you want to keep.
The problem is that I made an AJAX system that fetches those pages from the server, gets the title and set the current title to that title, and displays the page in a <div>.
I'll think about the include method you said. My current solution is to get the page using cURL, but that sure isn't the best way.
Hmmm... I'm not sure what eval() will do if it encounters raw HTML... it might throw errors.
Also, note that file_get_contents() only works with PHP >= v4.3, if you have a version lower than that then if you read the link KV posted there's a function definition which performs the same job in earlier versions.
But nvm I think cURL is the best solution.
Have you searched php.net for fun and relevant things? Try searching for "execute" and see what comes up in the function list.