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 #175254 is a reply to message #175242] Mon, 29 August 2011 20:45 Go to previous message
A is currently offline  A
Messages: 17
Registered: June 2011
Karma:
Junior Member
> $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.

You may remove the @ before fopen which supresses error and see exact error
it prints out.
But if your allow_url_fopen is set to off you don't have much options as it
seems that this parameter cannot be set from ini_set or from .htaccess file
but only from php.ini file for security reasons.

Alternative is to use curl to open remote content.

<?php
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$output =
@htmlspecialchars(get_data( http://www.corporateairamerica.com/logbooks/CAA001/CAA00120110826160800.txt'));echo("$output<br
/>");?>
[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: Tue Nov 26 10:28:23 GMT 2024

Total time taken to generate the page: 0.05116 seconds