Includes from an external source ?

STG related Support requests. Post site related support issues or questions about Star Trek Guide, or any of the tools or services on STG -- Not for phpBB Support --
Forum rules
Image
Post site related support issues or questions about phpBB Academy at Star Trek Guide, tools or STG services.
Post site feedback here as well.
Programming and general coding support or assistance should be requested in the Coding Assistance forums.

No phpBB Support in this forum

Includes from an external source ?

Postby _Chris_ » 24 Jul 2011, 07:57

Been trying to include the content from one of my other websites onto a page in phpbb3, with this code:

Code: Select all
<?php echo file_get_contents('http://www.otherwebsiteaddress.com/website_page); ?>


but it's just not working - can anyone help please?

Thanks.

Chris
_Chris_
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 169
Joined: 19 Aug 2010, 09:06
Gender: Male
phpBB Knowledge: 1


Re: Includes from an external source ?

Postby topdown » 24 Jul 2011, 11:46

Whats not working?
It should return the entire web page.

Maybe its blocked on your host?
do an if(function_exists('file_get_contents')){ echo 'Function exists';}
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3031
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: Includes from an external source ?

Postby _Chris_ » 24 Jul 2011, 11:50

topdown wrote:Whats not working?
It should return the entire web page.

Maybe its blocked on your host?
do an if(function_exists('file_get_contents')){ echo 'Function exists';}

Thanks, is that the whole code, or is there any more to it please:

Code: Select all
if(function_exists('file_get_contents')){ echo 'Function exists';}
_Chris_
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 169
Joined: 19 Aug 2010, 09:06
Gender: Male
phpBB Knowledge: 1

Re: Includes from an external source ?

Postby topdown » 24 Jul 2011, 13:19

Its the whole code, its just going to echo Function exists if file_get_contents exists.
I just put it one line so it may look odd.

The point is to try and test what is failing. Because file_get_contents should get the page you put in it.
Unless it is restricted by the host or something like that.

Not sure, I'm just winging it at the moment.

What is the page you are trying to get.
I can try from localhost.
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3031
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: Includes from an external source ?

Postby _Chris_ » 25 Jul 2011, 01:47

Thanks, yep, that's working - but you can't just place an include in a template file - my hosts do allow includes from another website - anyone know how you do it please?
_Chris_
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 169
Joined: 19 Aug 2010, 09:06
Gender: Male
phpBB Knowledge: 1

Re: Includes from an external source ?

Postby topdown » 25 Jul 2011, 01:52

Cross domain includes won't work on any host, or shouldn't.
If they do get a new host as it is a huge security issue :)

Moving on to the issue.
Where are you putting this and how are you using it?

You should not be embedding this in the phpBB3 style template.
If the above condition prints Function exists then it should work.
Unless the site you are grabbing from blocks external gets.

Reguardless the only way for me to know what is going on is to know where you are putting your code and what site you are extracting data from.
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3031
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: Includes from an external source ?

Postby _Chris_ » 27 Jul 2011, 09:47

Totally happy with the hosts, but anyways someone else has now helped on this so all sorted, something to do with global vars.
_Chris_
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 169
Joined: 19 Aug 2010, 09:06
Gender: Male
phpBB Knowledge: 1

Re: Includes from an external source ?

Postby Obsidian » 02 Aug 2011, 18:40

...If you're using this to include PHP code from a remote source, please get rid of your server because, as topdown put it, it is a massive security issue. You might as well just setup public FTP to your site and allow anyone to change any files you have.
うるさいうるさいうるさい!

StopForumSpam Spam Reporting Database
Giving xrumer and friends a great big "screw you" since 2007.
User avatar
Obsidian    
Supporter
Supporter
 
Posts: 2250
Joined: 04 Mar 2008, 23:35
Gender: Male
phpBB Knowledge: 10

Re: Includes from an external source ?

Postby _Chris_ » 03 Aug 2011, 04:55

Obsidian wrote:...If you're using this to include PHP code from a remote source, please get rid of your server because, as topdown put it, it is a massive security issue. You might as well just setup public FTP to your site and allow anyone to change any files you have.

Don't worry, that part is all sorted - just needed an answer to the actual question, but as mentioned, it's been solved now.
_Chris_
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 169
Joined: 19 Aug 2010, 09:06
Gender: Male
phpBB Knowledge: 1

Re: Includes from an external source ?

Postby faku1810 » 08 Aug 2011, 04:27

When you say "is all sorted" you mean you found a way to do it without causing a security issue or that it's fine to risk your forum as long as you can include the php code in the end?

Even if it sounds like it, this is not sarcasm, I'm actually wondering what you mean by that.
faku1810    
Cadet IV
Cadet IV
 
Posts: 52
Joined: 09 Jul 2011, 16:31
Gender: Male
phpBB Knowledge: 1

Next

Return to STG Support

Who is online

Users browsing this forum: No registered users and 6 guests

cron