Including a file |
[eluser]Philo01[/eluser]
Hi there! I was wondering if there is a way to do this. Lets say you have a website (wordpress for example) and an standalone application (CodeIgniter). Now you want to include text generated by this application. Lets say our generated text link is: http://www.yoursite.com/mygenerator/output/text Now what you could do is just include that link, but many servers don't allow that: Code: <?php This will probably return: Quote:Warning: include() [function.include]: URL file-access is disabled in the server configuration (Is it maybe possible to create a file called in /mygenerator/output.php hook this file up to CI and load the data? Because if you would include mygenerator/output.php, this would work because it isn't a url.) Now a other way to include this is using an iframe, but I don't really like this because styling you have applied on your website, does not apply with data in your iFrame. Anyone who could help me out! ![]() Would really appreciate it! Kind regards, Philo Found Methods - #1 --------------------------------------------------------------------------------- I found this method to be working but not sure if its the best way. Create a file mygenerator/output.php and add the following line: Code: echo file_get_contents('http://www.yoursite.com/mygenerator/output/text'); Then include output.php in the main site ---------------------------------------------------------------------------------
[eluser]Ben Edmunds[/eluser]
An ajax request might be a good and easy way to accomplish this. Or the best way would probably be using curl, if your server supports it.
[eluser]Philo01[/eluser]
[quote author="Ben Edmunds" date="1256525657"]An ajax request might be a good and easy way to accomplish this. Or the best way would probably be using curl, if your server supports it.[/quote] Thanks for your reply! Well, the problem is that this is going to be an application that can be bought. So I would like to make it work as much out of the box as possible. file_get_contents = Not supported by every server curl = Not supported by every server Ajax = This is an option, because the only thing they would have to do is include a javascript file. Other options are welcome, so If anyone know another, please let me know ![]() Thanks! |
Welcome Guest, Not a member yet? Register Sign In |