FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fopen Problem
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: fopen Problem [message #175250 is a reply to message #175248] Mon, 29 August 2011 11:36 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 8/29/2011 12:19 AM, Call Me Tom wrote:
> On Sun, 28 Aug 2011 23:09:19 -0400, Jerry Stuckle
> <jstucklex(at)attglobal(dot)net> wrote:
>
>> On 8/28/2011 11:04 PM, Call Me Tom wrote:
>>> On Sun, 28 Aug 2011 20:44:27 -0400, Richard Damon
>>> <news(dot)x(dot)richarddamon(at)xoxy(dot)net> wrote:
>>>
>>>> On 8/28/11 8:21 PM, Call Me Tom wrote:
>>>> > I have the following statement in om=ne of my PHP scripts:
>>>> >
>>>> > $rep_file = @fopen($report,"r");
>>>> >
>>>> > Until recently the the file opened properly on my local test system
>>>> > and my web host. My web host has upgraded to a newer version of PHP
>>>> > and I noticed that the core configuration parameter "allow_url_fopen"
>>>> > is coded off. My test system, which still works, is coded on. I
>>>> > assume that this is the source of my problem and am hoping one of you
>>>> > will suggest a work around.
>>>> >
>>>> > Please keep in mind that I have minimal PHP experience and that I have
>>>> > no control over the host configuration.
>>>> >
>>>> > Thanks,
>>>> > Tom
>>>>
>>>> If $report has a value like "http://example.com/page", than yes, that is
>>>> the source of your problem.
>>>>
>>>> If $report is referring to a "normal" file path to a file on the server
>>>> (like "subdir/file" or "/home/usr/me/myfile") then it isn't.
>>>
>>> $report is
>>> http://www.corporateairamerica.com/logbooks/CAA001/CAA00120110826160800.txt
>>>
>>> This text file is in a subdirectory of my home directory. Instead of
>>> using the above format, can I refer to the file in the fopen as simply
>>> /logbooks/CAA001/blahblah.txt ?
>>>
>>> Tom
>>
>> You can, but the results may be different.
>>
>> The first question would be - why are you opening using a URL? It's not
>> normal to open a file from your own server like this, but there are
>> valid reasons for doing it.
>
> I didn't write the program so I don't know if there is a valid reason.
> This is how it is used -
> When a pilot clicks on his ID, a page is loaded that shows all his
> flights in the format of a 3 col table. The columns being
> Date/To/from. If the pilot then clicks on the date another page is
> displayed showing the complete detail of that specific flight. The
> text file in question is that complete log. It is output using
>
> $rep_file = @fopen($report,"r");
> while (!feof($rep_file))
> { $output = @htmlspecialchars(fgets($rep_file, 1024));
> echo("$output<br />");
> }
> @fclose($rep_file);
>
> Hope this helps.
>
> Tom

Not really. A lot depends on what's in the file.

When you open a file locally, you get the file just as it exists on the
server. However, when you open it via a URL, you get the file after it
has been processed by the server.

As an example - if this file contained php code, opening it locally you
get the file containing the php code. However, opening it via the URL
would cause the PHP code to be executed and you would get the results of
the code.

Not knowing what the original programmer wanted makes this difficult.
However, from your description it sounds like a database would have been
much more appropriate to hold the data, I would suspect whoever wrote
it in the first place probably had no idea what he/she was doing and
there are a lot more problems in the application.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Strategic Marketing Summit 2011 (September 24th,Chennai)
Next Topic: does paypal standard method supports for recurring payment.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 20:36:28 GMT 2024

Total time taken to generate the page: 0.05257 seconds