Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,044 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,202 people online right now. Registration is fast and FREE... Join Now!




using fopen to access a php file

 
Reply to this topicStart new topic

using fopen to access a php file

klamonte
post 4 Mar, 2008 - 08:28 AM
Post #1


New D.I.C Head

*
Joined: 4 Mar, 2008
Posts: 4

Ok here we go,

My assignment is to create a php script that will calculate how may months old you are using years and months, as an added challenge if the result is over 500 months old then the screen will echo "you are old". This part of the script works fine.
My professor would also like the program to "call up another php program (hello.php) upon entering the sentinel value of 99999. My questions is that all of the documentation I have found refers to opening a txt file, so will php 'execute' another php file and actually return the result of that file?
I have attached the code for you to see, also the program is online at http://www.traugotts.com/tulane/months.php for you to run.


Attached File  months.php ( 776bytes ) Number of downloads: 26

User is offlineProfile CardPM

Go to the top of the page

SpaceMan
post 4 Mar, 2008 - 09:35 AM
Post #2


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

you say, he said, "call up another php program (hello.php) upon entering the sentinel value of 99999"

call up another php program (hello.php)
why would this have to be using fopen?

if it nessary, use fopen to open, php.net, read the contents.

then eval it.
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 4 Mar, 2008 - 07:40 PM
Post #3


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,324



Thanked 57 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


QUOTE(klamonte @ 4 Mar, 2008 - 09:28 AM) *

I have found refers to opening a txt file, so will php 'execute' another php file and actually return the result of that file?

Since php executes on the server, it can open a file as long as it has the correct permission to. However, I would suggest this is a bad idea. If there is an unforseen bug in the code, it could render the changed php program as useless.
User is online!Profile CardPM

Go to the top of the page

Mike007
post 4 Mar, 2008 - 09:37 PM
Post #4


D.I.C Head

Group Icon
Joined: 30 Aug, 2007
Posts: 200



Dream Kudos: 75
My Contributions


Umm have i missed something? if it's on the same server, why can't you call include()?

He didn't mention anything about being on 2 different servers smile.gif.
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 4 Mar, 2008 - 09:42 PM
Post #5


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,324



Thanked 57 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


QUOTE(Mike007 @ 4 Mar, 2008 - 10:37 PM) *

Umm have i missed something? if it's on the same server, why can't you call include()?

He didn't mention anything about being on 2 different servers smile.gif.

Or require once
User is online!Profile CardPM

Go to the top of the page

SpaceMan
post 5 Mar, 2008 - 05:05 AM
Post #6


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

the way he said implied that he has to do it a certian way.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 06:16AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month