Jump to content

[SOLVED] How To Create A Non Existant Page...


PHPNewbie55

Recommended Posts

Hey this is my first post!!  Cool Forum...!

-------------------------------------------------

OK

Here is what I am trying to do....

 

I am trying to create an RSS Feed from my MySQL Database Category Structure...

 

The ONLY part I need help with...

 

I need to be able to CREATE a page with PHP.

 

I know about the mkdir() and how to use that...

But these RSS pages do not exist yet.. and I need to create them with PHP.

 

So how would I go about creating a PAGE...

 

The fputs() command requires that the page I am trying to update already exist...

I need something similar that will CREATE it and then I can fputs() the data into the page....

 

I have exhausted all other resources and I can not find this info any where...

Any help would be GREATLY APPRECIATED!

 

 

Link to comment
Share on other sites

Lets just say you wanted to make a text file on your server that did not exist....

In a directory that was chmod 644 so you could write to it...

 

If a file exists I can fputs() all day long...  ;D

 

But if the file does not exist..???

 

How would you tell PHP to create it for you with the proper permissions to fputs() data later...????

Link to comment
Share on other sites

fopen("file", "w") will create a file that doesn't exist.  But the directory MUST exist first.  You need to check the return value of fopen() to see that it's really opened the file.

 

If fopen() isn't working, there may be a permissions problem.

Link to comment
Share on other sites

OMG....

 

LOL...

 

It was in front of my face the whole time...

I just forgot to give my folder the right permissions so it was goiving me an error....

 

MAN....

 

I guess that is what you get for staring at a big page of PHP script all day...

You just lose focus...!

 

 

Thanks for bringing it into focus for me....

If you knew how much time I wasted today...  heh heh heh..!

 

;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.