Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3002
| From | "A" <a@a.a> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: fopen Problem |
| Date | 2011-08-29 22:45 +0200 |
| Organization | B.net Hrvatska d.o.o. |
| Message-ID | <j3gtpi$sl4$1@gregory.bnet.hr> (permalink) |
| References | <d5ml57hndn054kn62b8tlpdpeto5v3jsv0@4ax.com> |
> $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
/>");?>
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
fopen Problem Call Me Tom <noemail@nowhere.com> - 2011-08-28 20:21 -0400
Re: fopen Problem Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-28 20:43 -0400
Re: fopen Problem Richard Damon <news.x.richarddamon@xoxy.net> - 2011-08-28 20:44 -0400
Re: fopen Problem Call Me Tom <noemail@nowhere.com> - 2011-08-28 23:04 -0400
Re: fopen Problem Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-28 23:09 -0400
Re: fopen Problem Call Me Tom <noemail@nowhere.com> - 2011-08-29 00:19 -0400
Re: fopen Problem Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-29 07:36 -0400
Re: fopen Problem Call Me Tom <noemail@nowhere.com> - 2011-08-29 19:15 -0400
Re: fopen Problem "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-29 13:37 +0200
Re: fopen Problem sheldonlg <sheldonlg@thevillages.net> - 2011-08-30 19:30 -0400
Re: fopen Problem Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-30 20:04 -0400
Re: fopen Problem "A" <a@a.a> - 2011-08-31 12:49 +0200
Re: fopen Problem Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-31 07:22 -0400
Re: fopen Problem sheldonlg <sheldonlg@thevillages.net> - 2011-08-31 08:59 -0400
Re: fopen Problem Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-31 13:39 -0400
Re: fopen Problem "A" <a@a.a> - 2011-08-29 22:45 +0200
csiph-web