The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 20, 2019, 11:34:48 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: remote file includes?  (Read 3418 times)
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« on: March 15, 2008, 03:27:49 PM »

i just discovered that php can do remote file includes...

aside from the obvious willies this gives me, I might want to use this for something.

the question is, how do I make it fail gracefully if the file is not found? ie, the interwebs decide to poop on the connection.
will it just timeout on its own, and I can then test for something to see if it got it?

also, what is the scope of that included code? Is it actually as if it is local to the scope you called it from? If so, i guess thats how I can test, check for a known variable that I would set.

Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #1 on: March 16, 2008, 02:38:51 AM »

http://php.net/include/

?
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #2 on: March 16, 2008, 08:45:58 AM »

yea I read it, but its confusing how they word it and the example they give. But i get it now.

include('http://www.somesite.com/remote.txt');

is valid. they make it seem like it isn't in the example, unless you read it a few more times.

thanks
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #3 on: March 16, 2008, 11:46:54 AM »

I was under the impression that many hosts disable remote file includes? So it may not be a practical solution.

DM
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #4 on: March 16, 2008, 01:40:27 PM »

oh ok. thanks for the heads up. i probably wont do it, and instead do a different method for code updating.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: March 17, 2008, 10:46:41 AM »

If you're going where I think you are, then you might consider just apache-ing a file from a primary location and then writing the file locally, then including it. You could check the LUPDATE or mtime on the remote file against yours, and if it's later than the local, get it and store before you include.

Have you read up on eval() as well?
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #6 on: March 17, 2008, 11:10:43 AM »

yea i read up on eval, and i cant stop reading it as evil...

But i decided to got the "push" route. My remote files will have a way to receive updates. a little better that way anyway i think, though the security is a bit, um... dicey.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #7 on: March 17, 2008, 11:13:53 AM »

Well, if you're pushing then someone else *could* figger it out and push something else... a callback ping and pull would be cleaner IMO (ping the remote, it calls home for instructions and pulls new code) if the phone home is over https then it'll be REALLY hard for someone to get in the middle of all of that...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!