file_get_contents ($file) works -- file_get_contents ($url) returns false

file_get_contents ($file) works -- file_get_contents ($url) returns false

am 09.12.2009 14:45:35 von m5

--Apple-Mail-22-738777640
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii

Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. Any =
call of file_get_contents() on a local file works fine -- the file is =
read and returned. But any call of file_get_contents on a url -- any =
url, local or remote -- always returns false.

var_dump (file_get_contents ('http://www.google.com/'));

bool(false)=20

I've checked php.ini, and the obvious seems okay:

allow_url_fopen =3D> On =3D> On
=20
Any ideas?

....Rene=

--Apple-Mail-22-738777640--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 09.12.2009 15:05:13 von Richard Quadling

2009/12/9 René Fournier :
> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. Any c=
all of file_get_contents() on a local file works fine -- the file is read a=
nd returned. But any call of file_get_contents on a url -- any url, local o=
r remote -- always returns false.
>
> var_dump (file_get_contents ('http://www.google.com/'));
>
> bool(false)
>
> I've checked php.ini, and the obvious seems okay:
>
>        allow_url_fopen =3D> On =3D> On
>
> Any ideas?
>
> ...Rene

If you enable all errors, anything extra? ...

error_reporting(-1);
ini_set('display_errors', 1);
set_time_limit(0); // Just in case it takes more than your default
execution time.

var_dump(file_get_contents('http://www.google.com'));





--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 09.12.2009 15:30:30 von kranthi

may be unrelated to your problem... but are you behind a proxy?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 09.12.2009 16:02:28 von LinuxManMikeC

On Wed, Dec 9, 2009 at 6:45 AM, René Fournier wr=
ote:
> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. Any c=
all of file_get_contents() on a local file works fine -- the file is read a=
nd returned. But any call of file_get_contents on a url -- any url, local o=
r remote -- always returns false.
>
> var_dump (file_get_contents ('http://www.google.com/'));
>
> bool(false)
>
> I've checked php.ini, and the obvious seems okay:
>
>        allow_url_fopen =3D> On =3D> On
>
> Any ideas?
>
> ...Rene

http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fop=
en

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 09.12.2009 16:03:52 von LinuxManMikeC

On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC wro=
te:
> On Wed, Dec 9, 2009 at 6:45 AM, René Fournier =
wrote:
>> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. Any =
call of file_get_contents() on a local file works fine -- the file is read =
and returned. But any call of file_get_contents on a url -- any url, local =
or remote -- always returns false.
>>
>> var_dump (file_get_contents ('http://www.google.com/'));
>>
>> bool(false)
>>
>> I've checked php.ini, and the obvious seems okay:
>>
>>        allow_url_fopen =3D> On =3D> On
>>
>> Any ideas?
>>
>> ...Rene
>
> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-f=
open
>

"I've checked php.ini"
Right, must remember not to reply to stuff till I'm awake. :-D

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 09.12.2009 16:42:31 von m5

--Apple-Mail-1-745793452
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii

No.
And it doesn't matter if the url is local (localhost, host.domain.com) =
or remote.

On 2009-12-09, at 10:30 PM, kranthi wrote:

> may be unrelated to your problem... but are you behind a proxy?


--Apple-Mail-1-745793452--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 09.12.2009 16:44:22 von m5

--Apple-Mail-2-745904963
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8

It is, and I use curl elsewhere in the same script to fetch remote =
content.
This exact same function works fine on my MacBook Pro (10.6 client, PHP =
5.3), and *was* previously working fine under Server 10.4.11 and PHP =
5.3,

On 2009-12-09, at 11:10 PM, laruence wrote:

> try=20
> wget http://www.google.com in your command line to see whether the =
network is reachable
>=20
> LinuxManMikeC wrote:
>>=20
>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>> =20
>>> On Wed, Dec 9, 2009 at 6:45 AM, René Fournier =
wrote:
>>> =20
>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. =
Any call of file_get_contents() on a local file works fine -- the file =
is read and returned. But any call of file_get_contents on a url -- any =
url, local or remote -- always returns false.
>>>>=20
>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>>>=20
>>>> bool(false)
>>>>=20
>>>> I've checked php.ini, and the obvious seems okay:
>>>>=20
>>>> allow_url_fopen =3D> On =3D> On
>>>>=20
>>>> Any ideas?
>>>>=20
>>>> ...Rene
>>>> =20
>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
>>>=20
>>> =20
>>=20
>> "I've checked php.ini"
>> Right, must remember not to reply to stuff till I'm awake. :-D
>>=20
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>=20
>> =20
>=20
> --=20
> <2866791487_dbbbdddf9e.jpg>æƒ=A0 新宸 xinchen.hui | =
商务搜索éƒ=A8 | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence


--Apple-Mail-2-745904963--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 09.12.2009 17:28:56 von Richard Quadling

2009/12/9 René Fournier :
> It is, and I use curl elsewhere in the same script to fetch remote conten=
t.
> This exact same function works fine on my MacBook Pro (10.6 client, PHP 5=
..3), and *was* previously working fine under Server 10.4.11 and PHP 5.3,
>
> On 2009-12-09, at 11:10 PM, laruence wrote:
>
>> try
>> wget http://www.google.com in your command line to see whether the netwo=
rk is reachable
>>
>> LinuxManMikeC wrote:
>>>
>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>>>
>>>> On Wed, Dec 9, 2009 at 6:45 AM, René Fournier m> wrote:
>>>>
>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. A=
ny call of file_get_contents() on a local file works fine -- the file is re=
ad and returned. But any call of file_get_contents on a url -- any url, loc=
al or remote -- always returns false.
>>>>>
>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>>>>
>>>>> bool(false)
>>>>>
>>>>> I've checked php.ini, and the obvious seems okay:
>>>>>
>>>>>        allow_url_fopen =3D> On =3D> On
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> ...Rene
>>>>>
>>>> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-ur=
l-fopen
>>>>
>>>>
>>>
>>> "I've checked php.ini"
>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> --
>> <2866791487_dbbbdddf9e.jpg>æƒ=A0 新宸 xinchen.hui | =
商务搜索éƒ=A8 | (+8610)82602112-7974 | <286=
6349865_203e53a6c6.jpg>:laruence
>
>

Do you have ANY errors/warning/notices?



--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 10.12.2009 16:31:51 von m5

--Apple-Mail-2-831554191
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8

I thought error_reporting would display them, but I guess php.ini had =
them suppressed. Anyway, with:


error_reporting(-1);
ini_set('display_errors', 1);
set_time_limit(0);
var_dump (file_get_contents ('http://www.google.com'));

?>

I get:

Warning: file_get_contents(http://www.google.com): failed to open =
stream: Operation now in progress in /____/____.php on line 7 =
bool(false)

Does that help with the diagnosis?


On 2009-12-10, at 12:28 AM, Richard Quadling wrote:

> 2009/12/9 René Fournier :
>> It is, and I use curl elsewhere in the same script to fetch remote =
content.
>> This exact same function works fine on my MacBook Pro (10.6 client, =
PHP 5.3), and *was* previously working fine under Server 10.4.11 and PHP =
5.3,
>>=20
>> On 2009-12-09, at 11:10 PM, laruence wrote:
>>=20
>>> try
>>> wget http://www.google.com in your command line to see whether the =
network is reachable
>>>=20
>>> LinuxManMikeC wrote:
>>>>=20
>>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>>>>=20
>>>>> On Wed, Dec 9, 2009 at 6:45 AM, René Fournier =
wrote:
>>>>>=20
>>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP =
5.3. Any call of file_get_contents() on a local file works fine -- the =
file is read and returned. But any call of file_get_contents on a url -- =
any url, local or remote -- always returns false.
>>>>>>=20
>>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>>>>>=20
>>>>>> bool(false)
>>>>>>=20
>>>>>> I've checked php.ini, and the obvious seems okay:
>>>>>>=20
>>>>>> allow_url_fopen =3D> On =3D> On
>>>>>>=20
>>>>>> Any ideas?
>>>>>>=20
>>>>>> ...Rene
>>>>>>=20
>>>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
>>>>>=20
>>>>>=20
>>>>=20
>>>> "I've checked php.ini"
>>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>>=20
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>=20
>>>>=20
>>>=20
>>> --
>>> <2866791487_dbbbdddf9e.jpg>æƒ=A0 新宸 xinchen.hui =
| 商务搜索éƒ=A8 | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence
>>=20
>>=20
>=20
> Do you have ANY errors/warning/notices?
>=20
>=20
>=20
> --=20
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
> ZOPA : http://uk.zopa.com/member/RQuadling


--Apple-Mail-2-831554191--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 11.12.2009 07:55:47 von Gaurav Kumar

--00504502b251d88dae047a6e6928
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

A very typical problem. Good you sent the error message.

This problem can be caused due to one of the following-

1. I have faced similar problem due to local firewall settings.
2. Try some other domain; i.e. other than google com. Try some of the local
area website with a particular page like www.somedomain.com/somefile.html
3. Some times the remote host does not allow you to connect to get the file
contents.
4. # 3 can be either way round from both the ends a) you host server does
not allow external connections b) Remote host does not allow anonymous
connection.

Hope this helps..

Gaurav Kumar
blog.oswebstudio.com



On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier w=
rote:

> I thought error_reporting would display them, but I guess php.ini had the=
m
> suppressed. Anyway, with:
>
> >
> error_reporting(-1);
> ini_set('display_errors', 1);
> set_time_limit(0);
> var_dump (file_get_contents ('http://www.google.com'));
>
> ?>
>
> I get:
>
> Warning: file_get_contents(http://www.google.com): failed to open stream:
> Operation now in progress in /____/____.php on line 7 bool(false)
>
> Does that help with the diagnosis?
>
>
> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>
> > 2009/12/9 Ren¨¦ Fournier :
> >> It is, and I use curl elsewhere in the same script to fetch remote
> content.
> >> This exact same function works fine on my MacBook Pro (10.6 client, PH=
P
> 5.3), and *was* previously working fine under Server 10.4.11 and PHP 5.3,
> >>
> >> On 2009-12-09, at 11:10 PM, laruence wrote:
> >>
> >>> try
> >>> wget http://www.google.com in your command line to see whether the
> network is reachable
> >>>
> >>> LinuxManMikeC wrote:
> >>>>
> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
> linuxmanmikec@gmail.com> wrote:
> >>>>
> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier ..com>
> wrote:
> >>>>>
> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3=
..
> Any call of file_get_contents() on a local file works fine -- the file is
> read and returned. But any call of file_get_contents on a url -- any url,
> local or remote -- always returns false.
> >>>>>>
> >>>>>> var_dump (file_get_contents ('http://www.google.com/') google.com/%27%29>
> );
> >>>>>>
> >>>>>> bool(false)
> >>>>>>
> >>>>>> I've checked php.ini, and the obvious seems okay:
> >>>>>>
> >>>>>> allow_url_fopen =3D> On =3D> On
> >>>>>>
> >>>>>> Any ideas?
> >>>>>>
> >>>>>> ...Rene
> >>>>>>
> >>>>>
> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-f=
open
> >>>>>
> >>>>>
> >>>>
> >>>> "I've checked php.ini"
> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
> >>>>
> >>>> --
> >>>> PHP General Mailing List (http://www.php.net/)
> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>
> >>>>
> >>>
> >>> --
> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | ÉÌ=
ÎñËÑË÷²¿ |
> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
> >>
> >>
> >
> > Do you have ANY errors/warning/notices?
> >
> >
> >
> > --
> > -----
> > Richard Quadling
> > "Standing on the shoulders of some very clever giants!"
> > EE : http://www.experts-exchange.com/M_248814.html
> > Zend Certified Engineer :
> http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
> > ZOPA : http://uk.zopa.com/member/RQuadling
>
>

--00504502b251d88dae047a6e6928--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 11.12.2009 14:22:19 von m5

--Apple-Mail-4-910181513
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=GB2312

Hi Gaurav,

On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:

> A very typical problem. Good you sent the error message.
>=20
> This problem can be caused due to one of the following-
>=20
> 1. I have faced similar problem due to local firewall settings.

Don't think this is it, since (1) the firewall settings haven't changed, =
and (2) other machines on the same network can execute this same code =
and function (but they aren't running OS X Server 10.6.

> 2. Try some other domain; i.e. other than google com. Try some of the =
local area website with a particular page like =
www.somedomain.com/somefile.html

I've tried many different external and local web sites, and they all =
fail.

> 3. Some times the remote host does not allow you to connect to get the =
file contents.

(Also not the cause -- as explained above.)

> 4. # 3 can be either way round from both the ends a) you host server =
does not allow external connections b) Remote host does not allow =
anonymous connection.

Thanks for the options. I don't think they apply in this case. If you =
have any other suggestions on what to do, I would welcome them.



> Gaurav Kumar
> blog.oswebstudio.com
>=20
>=20
>=20
> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier =
wrote:
> I thought error_reporting would display them, but I guess php.ini had =
them suppressed. Anyway, with:
>=20
> >=20
> error_reporting(-1);
> ini_set('display_errors', 1);
> set_time_limit(0);
> var_dump (file_get_contents ('http://www.google.com'));
>=20
> ?>
>=20
> I get:
>=20
> Warning: file_get_contents(http://www.google.com): failed to open =
stream: Operation now in progress in /____/____.php on line 7 =
bool(false)
>=20
> Does that help with the diagnosis?
>=20
>=20
> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>=20
> > 2009/12/9 Ren¨¦ Fournier :
> >> It is, and I use curl elsewhere in the same script to fetch remote =
content.
> >> This exact same function works fine on my MacBook Pro (10.6 client, =
PHP 5.3), and *was* previously working fine under Server 10.4.11 and PHP =
5.3,
> >>
> >> On 2009-12-09, at 11:10 PM, laruence wrote:
> >>
> >>> try
> >>> wget http://www.google.com in your command line to see whether the =
network is reachable
> >>>
> >>> LinuxManMikeC wrote:
> >>>>
> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
> >>>>
> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier =
wrote:
> >>>>>
> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP =
5.3. Any call of file_get_contents() on a local file works fine -- the =
file is read and returned. But any call of file_get_contents on a url -- =
any url, local or remote -- always returns false.
> >>>>>>
> >>>>>> var_dump (file_get_contents ('http://www.google.com/'));
> >>>>>>
> >>>>>> bool(false)
> >>>>>>
> >>>>>> I've checked php.ini, and the obvious seems okay:
> >>>>>>
> >>>>>> allow_url_fopen =3D> On =3D> On
> >>>>>>
> >>>>>> Any ideas?
> >>>>>>
> >>>>>> ...Rene
> >>>>>>
> >>>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
> >>>>>
> >>>>>
> >>>>
> >>>> "I've checked php.ini"
> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
> >>>>
> >>>> --
> >>>> PHP General Mailing List (http://www.php.net/)
> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>
> >>>>
> >>>
> >>> --
> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =
ÉÌÎñËÑË÷²¿ | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence
> >>
> >>
> >
> > Do you have ANY errors/warning/notices?
> >
> >
> >
> > --
> > -----
> > Richard Quadling
> > "Standing on the shoulders of some very clever giants!"
> > EE : http://www.experts-exchange.com/M_248814.html
> > Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
> > ZOPA : http://uk.zopa.com/member/RQuadling
>=20
>=20


--Apple-Mail-4-910181513--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 12.12.2009 21:00:32 von Gaurav Kumar

--00504502cb222b672d047a8d7ebc
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

Hi Rene,

The only thing which is a hurdle is that your system/computer is not
allowing external connections. There seems to be nothing else wrong.

I strongly suggest check your system firewall, any central server settings
through which your system gets internet access, any antivirus s/w installed
etc.. this can be the only reason. Something is stopping you to access
external connection.

Let me know when your problem is fixed.
Also I tried the below code and it works fine-

$str =3D file_get_contents ('http://www.google.com');
echo $str;
?>

Thanks,

Gaurav Kumar



2009/12/11 Ren¨¦ Fournier

> Hi Gaurav,
>
> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>
> A very typical problem. Good you sent the error message.
>
> This problem can be caused due to one of the following-
>
> 1. I have faced similar problem due to local firewall settings.
>
>
> Don't think this is it, since (1) the firewall settings haven't changed,
> and (2) other machines on the same network can execute this same code and
> function (but they aren't running OS X Server 10.6.
>
> 2. Try some other domain; i.e. other than google com. Try some of the loc=
al
> area website with a particular page like www.somedomain.com/somefile.html
>
>
> I've tried many different external and local web sites, and they all fail=
..
>
> 3. Some times the remote host does not allow you to connect to get the fi=
le
> contents.
>
>
> (Also not the cause -- as explained above.)
>
>
> 4. # 3 can be either way round from both the ends a) you host server does
> not allow external connections b) Remote host does not allow anonymous
> connection.
>
>
> Thanks for the options. I don't think they apply in this case. If you hav=
e
> any other suggestions on what to do, I would welcome them.
>
>
>
> Gaurav Kumar
> blog.oswebstudio.com
>
>
>
> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier =
wrote:
>
>> I thought error_reporting would display them, but I guess php.ini had th=
em
>> suppressed. Anyway, with:
>>
>> >>
>> error_reporting(-1);
>> ini_set('display_errors', 1);
>> set_time_limit(0);
>> var_dump (file_get_contents ('http://www.google.com'));
>>
>> ?>
>>
>> I get:
>>
>> Warning: file_get_contents(http://www.google.com): failed to open stream=
:
>> Operation now in progress in /____/____.php on line 7 bool(false)
>>
>> Does that help with the diagnosis?
>>
>>
>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>
>> > 2009/12/9 Ren¨¦ Fournier :
>> >> It is, and I use curl elsewhere in the same script to fetch remote
>> content.
>> >> This exact same function works fine on my MacBook Pro (10.6 client, P=
HP
>> 5.3), and *was* previously working fine under Server 10.4.11 and PHP 5.3=
,
>> >>
>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>> >>
>> >>> try
>> >>> wget http://www.google.com in your command line to see whether the
>> network is reachable
>> >>>
>> >>> LinuxManMikeC wrote:
>> >>>>
>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
>> linuxmanmikec@gmail.com> wrote:
>> >>>>
>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier r.com>
>> wrote:
>> >>>>>
>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.=
3.
>> Any call of file_get_contents() on a local file works fine -- the file i=
s
>> read and returned. But any call of file_get_contents on a url -- any url=
,
>> local or remote -- always returns false.
>> >>>>>>
>> >>>>>> var_dump (file_get_contents ('http://www.google.com/') ..google.com/%27%29>
>> );
>> >>>>>>
>> >>>>>> bool(false)
>> >>>>>>
>> >>>>>> I've checked php.ini, and the obvious seems okay:
>> >>>>>>
>> >>>>>> allow_url_fopen =3D> On =3D> On
>> >>>>>>
>> >>>>>> Any ideas?
>> >>>>>>
>> >>>>>> ...Rene
>> >>>>>>
>> >>>>>
>> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-=
fopen
>> >>>>>
>> >>>>>
>> >>>>
>> >>>> "I've checked php.ini"
>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>> >>>>
>> >>>> --
>> >>>> PHP General Mailing List (http://www.php.net/)
>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>>>
>> >>>>
>> >>>
>> >>> --
>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | ÉÌ=
ÎñËÑË÷²¿ |
>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>> >>
>> >>
>> >
>> > Do you have ANY errors/warning/notices?
>> >
>> >
>> >
>> > --
>> > -----
>> > Richard Quadling
>> > "Standing on the shoulders of some very clever giants!"
>> > EE : http://www.experts-exchange.com/M_248814.html
>> > Zend Certified Engineer :
>> http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>
>>
>
>

--00504502cb222b672d047a8d7ebc--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 13.12.2009 00:38:25 von m5

--Apple-Mail-13-1033547818
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=GB2312

The thing is, the file_get_contents() fails the same way on local URLs =
-- that is, web sites hosted on the same machine. Or even using the =
machine's own IP address.

On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:

> Hi Rene,
>=20
> The only thing which is a hurdle is that your system/computer is not =
allowing external connections. There seems to be nothing else wrong.
>=20
> I strongly suggest check your system firewall, any central server =
settings through which your system gets internet access, any antivirus =
s/w installed etc.. this can be the only reason. Something is stopping =
you to access external connection.
>=20
> Let me know when your problem is fixed.
> Also I tried the below code and it works fine-
>=20
> > $str =3D file_get_contents ('http://www.google.com');
> echo $str;
> ?>
>=20
> Thanks,
>=20
> Gaurav Kumar
>=20
>=20
>=20
> 2009/12/11 Ren¨¦ Fournier
> Hi Gaurav,
>=20
> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>=20
>> A very typical problem. Good you sent the error message.
>>=20
>> This problem can be caused due to one of the following-
>>=20
>> 1. I have faced similar problem due to local firewall settings.
>=20
> Don't think this is it, since (1) the firewall settings haven't =
changed, and (2) other machines on the same network can execute this =
same code and function (but they aren't running OS X Server 10.6.
>=20
>> 2. Try some other domain; i.e. other than google com. Try some of the =
local area website with a particular page like =
www.somedomain.com/somefile.html
>=20
> I've tried many different external and local web sites, and they all =
fail.
>=20
>> 3. Some times the remote host does not allow you to connect to get =
the file contents.
>=20
> (Also not the cause -- as explained above.)
>=20
>=20
>> 4. # 3 can be either way round from both the ends a) you host server =
does not allow external connections b) Remote host does not allow =
anonymous connection.
>=20
> Thanks for the options. I don't think they apply in this case. If you =
have any other suggestions on what to do, I would welcome them.
>=20
>=20
>=20
>> Gaurav Kumar
>> blog.oswebstudio.com
>>=20
>>=20
>>=20
>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier =
wrote:
>> I thought error_reporting would display them, but I guess php.ini had =
them suppressed. Anyway, with:
>>=20
>> >>=20
>> error_reporting(-1);
>> ini_set('display_errors', 1);
>> set_time_limit(0);
>> var_dump (file_get_contents ('http://www.google.com'));
>>=20
>> ?>
>>=20
>> I get:
>>=20
>> Warning: file_get_contents(http://www.google.com): failed to open =
stream: Operation now in progress in /____/____.php on line 7 =
bool(false)
>>=20
>> Does that help with the diagnosis?
>>=20
>>=20
>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>=20
>> > 2009/12/9 Ren¨¦ Fournier :
>> >> It is, and I use curl elsewhere in the same script to fetch remote =
content.
>> >> This exact same function works fine on my MacBook Pro (10.6 =
client, PHP 5.3), and *was* previously working fine under Server 10.4.11 =
and PHP 5.3,
>> >>
>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>> >>
>> >>> try
>> >>> wget http://www.google.com in your command line to see whether =
the network is reachable
>> >>>
>> >>> LinuxManMikeC wrote:
>> >>>>
>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>> >>>>
>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier =
wrote:
>> >>>>>
>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP =
5.3. Any call of file_get_contents() on a local file works fine -- the =
file is read and returned. But any call of file_get_contents on a url -- =
any url, local or remote -- always returns false.
>> >>>>>>
>> >>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>> >>>>>>
>> >>>>>> bool(false)
>> >>>>>>
>> >>>>>> I've checked php.ini, and the obvious seems okay:
>> >>>>>>
>> >>>>>> allow_url_fopen =3D> On =3D> On
>> >>>>>>
>> >>>>>> Any ideas?
>> >>>>>>
>> >>>>>> ...Rene
>> >>>>>>
>> >>>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
>> >>>>>
>> >>>>>
>> >>>>
>> >>>> "I've checked php.ini"
>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>> >>>>
>> >>>> --
>> >>>> PHP General Mailing List (http://www.php.net/)
>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>>>
>> >>>>
>> >>>
>> >>> --
>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =
ÉÌÎñËÑË÷²¿ | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence
>> >>
>> >>
>> >
>> > Do you have ANY errors/warning/notices?
>> >
>> >
>> >
>> > --
>> > -----
>> > Richard Quadling
>> > "Standing on the shoulders of some very clever giants!"
>> > EE : http://www.experts-exchange.com/M_248814.html
>> > Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>=20
>>=20
>=20
>=20


--Apple-Mail-13-1033547818--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 13.12.2009 09:39:10 von Gaurav Kumar

--00504502af593f406c047a9817ff
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

Ok Agreed.

Lets do one last chance to ensure that your system is allowing external
connections or connection to other systems in the network-

Use Curl to get in the file contents. Check your PHP that Curl is enabled.
Through phpinfo();

If the script output the google page then this means that there is nothing
that is stopping you form getting in the content externally.

// $str =3D file_get_contents ('http://www.google.com');
// echo $str;


// create a new cURL resource
$ch =3D curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in"); //
http://www.google.com
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

?>

Thanks,

Gaurav Kumar



2009/12/13 Ren¨¦ Fournier

> The thing is, the file_get_contents() fails the same way on local URLs --
> that is, web sites hosted on the same machine. Or even using the machine'=
s
> own IP address.
>
> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>
> Hi Rene,
>
> The only thing which is a hurdle is that your system/computer is not
> allowing external connections. There seems to be nothing else wrong.
>
> I strongly suggest check your system firewall, any central server setting=
s
> through which your system gets internet access, any antivirus s/w install=
ed
> etc.. this can be the only reason. Something is stopping you to access
> external connection.
>
> Let me know when your problem is fixed.
> Also I tried the below code and it works fine-
>
> > $str =3D file_get_contents ('http://www.google.com');
> echo $str;
> ?>
>
> Thanks,
>
> Gaurav Kumar
>
>
>
> 2009/12/11 Ren¨¦ Fournier
>
>> Hi Gaurav,
>>
>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>
>> A very typical problem. Good you sent the error message.
>>
>> This problem can be caused due to one of the following-
>>
>> 1. I have faced similar problem due to local firewall settings.
>>
>>
>> Don't think this is it, since (1) the firewall settings haven't changed,
>> and (2) other machines on the same network can execute this same code an=
d
>> function (but they aren't running OS X Server 10.6.
>>
>> 2. Try some other domain; i.e. other than google com. Try some of the
>> local area website with a particular page like
>> www.somedomain.com/somefile.html
>>
>>
>> I've tried many different external and local web sites, and they all fai=
l.
>>
>> 3. Some times the remote host does not allow you to connect to get the
>> file contents.
>>
>>
>> (Also not the cause -- as explained above.)
>>
>>
>> 4. # 3 can be either way round from both the ends a) you host server doe=
s
>> not allow external connections b) Remote host does not allow anonymous
>> connection.
>>
>>
>> Thanks for the options. I don't think they apply in this case. If you ha=
ve
>> any other suggestions on what to do, I would welcome them.
>>
>>
>>
>> Gaurav Kumar
>> blog.oswebstudio.com
>>
>>
>>
>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier >wrote:
>>
>>> I thought error_reporting would display them, but I guess php.ini had
>>> them suppressed. Anyway, with:
>>>
>>> >>>
>>> error_reporting(-1);
>>> ini_set('display_errors', 1);
>>> set_time_limit(0);
>>> var_dump (file_get_contents ('http://www.google.com'));
>>>
>>> ?>
>>>
>>> I get:
>>>
>>> Warning: file_get_contents(http://www.google.com): failed to open
>>> stream: Operation now in progress in /____/____.php on line 7 bool(fals=
e)
>>>
>>> Does that help with the diagnosis?
>>>
>>>
>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>
>>> > 2009/12/9 Ren¨¦ Fournier :
>>> >> It is, and I use curl elsewhere in the same script to fetch remote
>>> content.
>>> >> This exact same function works fine on my MacBook Pro (10.6 client,
>>> PHP 5.3), and *was* previously working fine under Server 10.4.11 and PH=
P
>>> 5.3,
>>> >>
>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>> >>
>>> >>> try
>>> >>> wget http://www.google.com in your command line to see whether the
>>> network is reachable
>>> >>>
>>> >>> LinuxManMikeC wrote:
>>> >>>>
>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
>>> linuxmanmikec@gmail.com> wrote:
>>> >>>>
>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier er.com>
>>> wrote:
>>> >>>>>
>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP
>>> 5.3. Any call of file_get_contents() on a local file works fine -- the =
file
>>> is read and returned. But any call of file_get_contents on a url -- any=
url,
>>> local or remote -- always returns false.
>>> >>>>>>
>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/') w.google.com/%27%29>
>>> );
>>> >>>>>>
>>> >>>>>> bool(false)
>>> >>>>>>
>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>> >>>>>>
>>> >>>>>> allow_url_fopen =3D> On =3D> On
>>> >>>>>>
>>> >>>>>> Any ideas?
>>> >>>>>>
>>> >>>>>> ...Rene
>>> >>>>>>
>>> >>>>>
>>> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url=
-fopen
>>> >>>>>
>>> >>>>>
>>> >>>>
>>> >>>> "I've checked php.ini"
>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>> >>>>
>>> >>>> --
>>> >>>> PHP General Mailing List (http://www.php.net/)
>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>> >>>>
>>> >>>>
>>> >>>
>>> >>> --
>>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | ÉÌ=
ÎñËÑË÷²¿ |
>>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>>> >>
>>> >>
>>> >
>>> > Do you have ANY errors/warning/notices?
>>> >
>>> >
>>> >
>>> > --
>>> > -----
>>> > Richard Quadling
>>> > "Standing on the shoulders of some very clever giants!"
>>> > EE : http://www.experts-exchange.com/M_248814.html
>>> > Zend Certified Engineer :
>>> http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>
>>>
>>
>>
>
>

--00504502af593f406c047a9817ff--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 13.12.2009 16:48:24 von m5

--Apple-Mail-18--1055736919
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=GB2312

CURL works (remote and local)
file_get_contents() doesn't work (remote or local).



On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:

> Ok Agreed.=20
>=20
> Lets do one last chance to ensure that your system is allowing =
external connections or connection to other systems in the network-
>=20
> Use Curl to get in the file contents. Check your PHP that Curl is =
enabled. Through phpinfo();
>=20
> If the script output the google page then this means that there is =
nothing that is stopping you form getting in the content externally.
>=20
> > // $str =3D file_get_contents ('http://www.google.com');
> // echo $str;
>=20
>=20
> // create a new cURL resource
> $ch =3D curl_init();
>=20
> // set URL and other appropriate options
> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in"); =
//http://www.google.com
> curl_setopt($ch, CURLOPT_HEADER, 0);
>=20
> // grab URL and pass it to the browser
> curl_exec($ch);
>=20
> // close cURL resource, and free up system resources
> curl_close($ch);
>=20
> ?>
>=20
> Thanks,
>=20
> Gaurav Kumar
>=20
>=20
>=20
> 2009/12/13 Ren¨¦ Fournier
> The thing is, the file_get_contents() fails the same way on local URLs =
-- that is, web sites hosted on the same machine. Or even using the =
machine's own IP address.
>=20
> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>=20
>> Hi Rene,
>>=20
>> The only thing which is a hurdle is that your system/computer is not =
allowing external connections. There seems to be nothing else wrong.
>>=20
>> I strongly suggest check your system firewall, any central server =
settings through which your system gets internet access, any antivirus =
s/w installed etc.. this can be the only reason. Something is stopping =
you to access external connection.
>>=20
>> Let me know when your problem is fixed.
>> Also I tried the below code and it works fine-
>>=20
>> >> $str =3D file_get_contents ('http://www.google.com');
>> echo $str;
>> ?>
>>=20
>> Thanks,
>>=20
>> Gaurav Kumar
>>=20
>>=20
>>=20
>> 2009/12/11 Ren¨¦ Fournier
>> Hi Gaurav,
>>=20
>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>=20
>>> A very typical problem. Good you sent the error message.
>>>=20
>>> This problem can be caused due to one of the following-
>>>=20
>>> 1. I have faced similar problem due to local firewall settings.
>>=20
>> Don't think this is it, since (1) the firewall settings haven't =
changed, and (2) other machines on the same network can execute this =
same code and function (but they aren't running OS X Server 10.6.
>>=20
>>> 2. Try some other domain; i.e. other than google com. Try some of =
the local area website with a particular page like =
www.somedomain.com/somefile.html
>>=20
>> I've tried many different external and local web sites, and they all =
fail.
>>=20
>>> 3. Some times the remote host does not allow you to connect to get =
the file contents.
>>=20
>> (Also not the cause -- as explained above.)
>>=20
>>=20
>>> 4. # 3 can be either way round from both the ends a) you host server =
does not allow external connections b) Remote host does not allow =
anonymous connection.
>>=20
>> Thanks for the options. I don't think they apply in this case. If you =
have any other suggestions on what to do, I would welcome them.
>>=20
>>=20
>>=20
>>> Gaurav Kumar
>>> blog.oswebstudio.com
>>>=20
>>>=20
>>>=20
>>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier =
wrote:
>>> I thought error_reporting would display them, but I guess php.ini =
had them suppressed. Anyway, with:
>>>=20
>>> >>>=20
>>> error_reporting(-1);
>>> ini_set('display_errors', 1);
>>> set_time_limit(0);
>>> var_dump (file_get_contents ('http://www.google.com'));
>>>=20
>>> ?>
>>>=20
>>> I get:
>>>=20
>>> Warning: file_get_contents(http://www.google.com): failed to open =
stream: Operation now in progress in /____/____.php on line 7 =
bool(false)
>>>=20
>>> Does that help with the diagnosis?
>>>=20
>>>=20
>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>=20
>>> > 2009/12/9 Ren¨¦ Fournier :
>>> >> It is, and I use curl elsewhere in the same script to fetch =
remote content.
>>> >> This exact same function works fine on my MacBook Pro (10.6 =
client, PHP 5.3), and *was* previously working fine under Server 10.4.11 =
and PHP 5.3,
>>> >>
>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>> >>
>>> >>> try
>>> >>> wget http://www.google.com in your command line to see whether =
the network is reachable
>>> >>>
>>> >>> LinuxManMikeC wrote:
>>> >>>>
>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>>> >>>>
>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier =
wrote:
>>> >>>>>
>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running =
PHP 5.3. Any call of file_get_contents() on a local file works fine -- =
the file is read and returned. But any call of file_get_contents on a =
url -- any url, local or remote -- always returns false.
>>> >>>>>>
>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>> >>>>>>
>>> >>>>>> bool(false)
>>> >>>>>>
>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>> >>>>>>
>>> >>>>>> allow_url_fopen =3D> On =3D> On
>>> >>>>>>
>>> >>>>>> Any ideas?
>>> >>>>>>
>>> >>>>>> ...Rene
>>> >>>>>>
>>> >>>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
>>> >>>>>
>>> >>>>>
>>> >>>>
>>> >>>> "I've checked php.ini"
>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>> >>>>
>>> >>>> --
>>> >>>> PHP General Mailing List (http://www.php.net/)
>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>> >>>>
>>> >>>>
>>> >>>
>>> >>> --
>>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =
ÉÌÎñËÑË÷²¿ | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence
>>> >>
>>> >>
>>> >
>>> > Do you have ANY errors/warning/notices?
>>> >
>>> >
>>> >
>>> > --
>>> > -----
>>> > Richard Quadling
>>> > "Standing on the shoulders of some very clever giants!"
>>> > EE : http://www.experts-exchange.com/M_248814.html
>>> > Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>=20
>>>=20
>>=20
>>=20
>=20
>=20


--Apple-Mail-18--1055736919--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 13.12.2009 17:26:03 von Gaurav Kumar

--001636e0b72def178c047a9e9c6e
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

What is the value for
"allow_url_fopen ini.allow-url-fopen>"
in your php.ini? It should be 1.





2009/12/13 Ren¨¦ Fournier

> CURL works (remote and local)
> file_get_contents() doesn't work (remote or local).
>
>
>
> On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:
>
> Ok Agreed.
>
> Lets do one last chance to ensure that your system is allowing external
> connections or connection to other systems in the network-
>
> Use Curl to get in the file contents. Check your PHP that Curl is enabled=
..
> Through phpinfo();
>
> If the script output the google page then this means that there is nothin=
g
> that is stopping you form getting in the content externally.
>
> > // $str =3D file_get_contents ('http://www.google.com');
> // echo $str;
>
>
> // create a new cURL resource
> $ch =3D curl_init();
>
> // set URL and other appropriate options
> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in"); //
> http://www.google.com
> curl_setopt($ch, CURLOPT_HEADER, 0);
>
> // grab URL and pass it to the browser
> curl_exec($ch);
>
> // close cURL resource, and free up system resources
> curl_close($ch);
>
> ?>
>
> Thanks,
>
> Gaurav Kumar
>
>
>
> 2009/12/13 Ren¨¦ Fournier
>
>> The thing is, the file_get_contents() fails the same way on local URLs -=
-
>> that is, web sites hosted on the same machine. Or even using the machine=
's
>> own IP address.
>>
>> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>>
>> Hi Rene,
>>
>> The only thing which is a hurdle is that your system/computer is not
>> allowing external connections. There seems to be nothing else wrong.
>>
>> I strongly suggest check your system firewall, any central server settin=
gs
>> through which your system gets internet access, any antivirus s/w instal=
led
>> etc.. this can be the only reason. Something is stopping you to access
>> external connection.
>>
>> Let me know when your problem is fixed.
>> Also I tried the below code and it works fine-
>>
>> >> $str =3D file_get_contents ('http://www.google.com');
>> echo $str;
>> ?>
>>
>> Thanks,
>>
>> Gaurav Kumar
>>
>>
>>
>> 2009/12/11 Ren¨¦ Fournier
>>
>>> Hi Gaurav,
>>>
>>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>>
>>> A very typical problem. Good you sent the error message.
>>>
>>> This problem can be caused due to one of the following-
>>>
>>> 1. I have faced similar problem due to local firewall settings.
>>>
>>>
>>> Don't think this is it, since (1) the firewall settings haven't changed=
,
>>> and (2) other machines on the same network can execute this same code a=
nd
>>> function (but they aren't running OS X Server 10.6.
>>>
>>> 2. Try some other domain; i.e. other than google com. Try some of the
>>> local area website with a particular page like
>>> www.somedomain.com/somefile.html
>>>
>>>
>>> I've tried many different external and local web sites, and they all
>>> fail.
>>>
>>> 3. Some times the remote host does not allow you to connect to get the
>>> file contents.
>>>
>>>
>>> (Also not the cause -- as explained above.)
>>>
>>>
>>> 4. # 3 can be either way round from both the ends a) you host server do=
es
>>> not allow external connections b) Remote host does not allow anonymous
>>> connection.
>>>
>>>
>>> Thanks for the options. I don't think they apply in this case. If you
>>> have any other suggestions on what to do, I would welcome them.
>>>
>>>
>>>
>>> Gaurav Kumar
>>> blog.oswebstudio.com
>>>
>>>
>>>
>>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier m>wrote:
>>>
>>>> I thought error_reporting would display them, but I guess php.ini had
>>>> them suppressed. Anyway, with:
>>>>
>>>> >>>>
>>>> error_reporting(-1);
>>>> ini_set('display_errors', 1);
>>>> set_time_limit(0);
>>>> var_dump (file_get_contents ('http://www.google.com'));
>>>>
>>>> ?>
>>>>
>>>> I get:
>>>>
>>>> Warning: file_get_contents(http://www.google.com): failed to open
>>>> stream: Operation now in progress in /____/____.php on line 7 bool(fal=
se)
>>>>
>>>> Does that help with the diagnosis?
>>>>
>>>>
>>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>>
>>>> > 2009/12/9 Ren¨¦ Fournier :
>>>> >> It is, and I use curl elsewhere in the same script to fetch remote
>>>> content.
>>>> >> This exact same function works fine on my MacBook Pro (10.6 client,
>>>> PHP 5.3), and *was* previously working fine under Server 10.4.11 and P=
HP
>>>> 5.3,
>>>> >>
>>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>>> >>
>>>> >>> try
>>>> >>> wget http://www.google.com in your command line to see whether the
>>>> network is reachable
>>>> >>>
>>>> >>> LinuxManMikeC wrote:
>>>> >>>>
>>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
>>>> linuxmanmikec@gmail.com> wrote:
>>>> >>>>
>>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier <
>>>> m5@renefournier.com> wrote:
>>>> >>>>>
>>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP
>>>> 5.3. Any call of file_get_contents() on a local file works fine -- the=
file
>>>> is read and returned. But any call of file_get_contents on a url -- an=
y url,
>>>> local or remote -- always returns false.
>>>> >>>>>>
>>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/') ww.google.com/%27%29>
>>>> );
>>>> >>>>>>
>>>> >>>>>> bool(false)
>>>> >>>>>>
>>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>>> >>>>>>
>>>> >>>>>> allow_url_fopen =3D> On =3D> On
>>>> >>>>>>
>>>> >>>>>> Any ideas?
>>>> >>>>>>
>>>> >>>>>> ...Rene
>>>> >>>>>>
>>>> >>>>>
>>>> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-ur=
l-fopen
>>>> >>>>>
>>>> >>>>>
>>>> >>>>
>>>> >>>> "I've checked php.ini"
>>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>> >>>>
>>>> >>>> --
>>>> >>>> PHP General Mailing List (http://www.php.net/)
>>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>> >>>>
>>>> >>>>
>>>> >>>
>>>> >>> --
>>>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =C9=
ÌÎñËÑË÷²=BF |
>>>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>>>> >>
>>>> >>
>>>> >
>>>> > Do you have ANY errors/warning/notices?
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > -----
>>>> > Richard Quadling
>>>> > "Standing on the shoulders of some very clever giants!"
>>>> > EE : http://www.experts-exchange.com/M_248814.html
>>>> > Zend Certified Engineer :
>>>> http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>>
>>>>
>>>
>>>
>>
>>
>
>

--001636e0b72def178c047a9e9c6e--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 14.12.2009 01:19:14 von m5

--Apple-Mail-19--1025086486
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=GB2312


PHP Version 5.3.0

Directive Local Value Master Value
allow_call_time_pass_reference Off Off
allow_url_fopen On


On 2009-12-14, at 12:26 AM, Gaurav Kumar wrote:

> What is the value for "allow_url_fopen" in your php.ini? It should be =
1.
>=20
>=20
>=20
>=20
>=20
> 2009/12/13 Ren¨¦ Fournier
> CURL works (remote and local)
> file_get_contents() doesn't work (remote or local).
>=20
>=20
>=20
> On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:
>=20
>> Ok Agreed.=20
>>=20
>> Lets do one last chance to ensure that your system is allowing =
external connections or connection to other systems in the network-
>>=20
>> Use Curl to get in the file contents. Check your PHP that Curl is =
enabled. Through phpinfo();
>>=20
>> If the script output the google page then this means that there is =
nothing that is stopping you form getting in the content externally.
>>=20
>> >> // $str =3D file_get_contents ('http://www.google.com');
>> // echo $str;
>>=20
>>=20
>> // create a new cURL resource
>> $ch =3D curl_init();
>>=20
>> // set URL and other appropriate options
>> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in"); =
//http://www.google.com
>> curl_setopt($ch, CURLOPT_HEADER, 0);
>>=20
>> // grab URL and pass it to the browser
>> curl_exec($ch);
>>=20
>> // close cURL resource, and free up system resources
>> curl_close($ch);
>>=20
>> ?>
>>=20
>> Thanks,
>>=20
>> Gaurav Kumar
>>=20
>>=20
>>=20
>> 2009/12/13 Ren¨¦ Fournier
>> The thing is, the file_get_contents() fails the same way on local =
URLs -- that is, web sites hosted on the same machine. Or even using the =
machine's own IP address.
>>=20
>> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>>=20
>>> Hi Rene,
>>>=20
>>> The only thing which is a hurdle is that your system/computer is not =
allowing external connections. There seems to be nothing else wrong.
>>>=20
>>> I strongly suggest check your system firewall, any central server =
settings through which your system gets internet access, any antivirus =
s/w installed etc.. this can be the only reason. Something is stopping =
you to access external connection.
>>>=20
>>> Let me know when your problem is fixed.
>>> Also I tried the below code and it works fine-
>>>=20
>>> >>> $str =3D file_get_contents ('http://www.google.com');
>>> echo $str;
>>> ?>
>>>=20
>>> Thanks,
>>>=20
>>> Gaurav Kumar
>>>=20
>>>=20
>>>=20
>>> 2009/12/11 Ren¨¦ Fournier
>>> Hi Gaurav,
>>>=20
>>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>>=20
>>>> A very typical problem. Good you sent the error message.
>>>>=20
>>>> This problem can be caused due to one of the following-
>>>>=20
>>>> 1. I have faced similar problem due to local firewall settings.
>>>=20
>>> Don't think this is it, since (1) the firewall settings haven't =
changed, and (2) other machines on the same network can execute this =
same code and function (but they aren't running OS X Server 10.6.
>>>=20
>>>> 2. Try some other domain; i.e. other than google com. Try some of =
the local area website with a particular page like =
www.somedomain.com/somefile.html
>>>=20
>>> I've tried many different external and local web sites, and they all =
fail.
>>>=20
>>>> 3. Some times the remote host does not allow you to connect to get =
the file contents.
>>>=20
>>> (Also not the cause -- as explained above.)
>>>=20
>>>=20
>>>> 4. # 3 can be either way round from both the ends a) you host =
server does not allow external connections b) Remote host does not allow =
anonymous connection.
>>>=20
>>> Thanks for the options. I don't think they apply in this case. If =
you have any other suggestions on what to do, I would welcome them.
>>>=20
>>>=20
>>>=20
>>>> Gaurav Kumar
>>>> blog.oswebstudio.com
>>>>=20
>>>>=20
>>>>=20
>>>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier =
wrote:
>>>> I thought error_reporting would display them, but I guess php.ini =
had them suppressed. Anyway, with:
>>>>=20
>>>> >>>>=20
>>>> error_reporting(-1);
>>>> ini_set('display_errors', 1);
>>>> set_time_limit(0);
>>>> var_dump (file_get_contents ('http://www.google.com'));
>>>>=20
>>>> ?>
>>>>=20
>>>> I get:
>>>>=20
>>>> Warning: file_get_contents(http://www.google.com): failed to open =
stream: Operation now in progress in /____/____.php on line 7 =
bool(false)
>>>>=20
>>>> Does that help with the diagnosis?
>>>>=20
>>>>=20
>>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>>=20
>>>> > 2009/12/9 Ren¨¦ Fournier :
>>>> >> It is, and I use curl elsewhere in the same script to fetch =
remote content.
>>>> >> This exact same function works fine on my MacBook Pro (10.6 =
client, PHP 5.3), and *was* previously working fine under Server 10.4.11 =
and PHP 5.3,
>>>> >>
>>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>>> >>
>>>> >>> try
>>>> >>> wget http://www.google.com in your command line to see whether =
the network is reachable
>>>> >>>
>>>> >>> LinuxManMikeC wrote:
>>>> >>>>
>>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>>>> >>>>
>>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier =
wrote:
>>>> >>>>>
>>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running =
PHP 5.3. Any call of file_get_contents() on a local file works fine -- =
the file is read and returned. But any call of file_get_contents on a =
url -- any url, local or remote -- always returns false.
>>>> >>>>>>
>>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>>> >>>>>>
>>>> >>>>>> bool(false)
>>>> >>>>>>
>>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>>> >>>>>>
>>>> >>>>>> allow_url_fopen =3D> On =3D> On
>>>> >>>>>>
>>>> >>>>>> Any ideas?
>>>> >>>>>>
>>>> >>>>>> ...Rene
>>>> >>>>>>
>>>> >>>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
>>>> >>>>>
>>>> >>>>>
>>>> >>>>
>>>> >>>> "I've checked php.ini"
>>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>> >>>>
>>>> >>>> --
>>>> >>>> PHP General Mailing List (http://www.php.net/)
>>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>> >>>>
>>>> >>>>
>>>> >>>
>>>> >>> --
>>>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =
ÉÌÎñËÑË÷²¿ | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence
>>>> >>
>>>> >>
>>>> >
>>>> > Do you have ANY errors/warning/notices?
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > -----
>>>> > Richard Quadling
>>>> > "Standing on the shoulders of some very clever giants!"
>>>> > EE : http://www.experts-exchange.com/M_248814.html
>>>> > Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>>=20
>>>>=20
>>>=20
>>>=20
>>=20
>>=20
>=20
>=20


--Apple-Mail-19--1025086486--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 14.12.2009 15:05:48 von Gaurav Kumar

--00504502b4683f06d1047ab0c5f1
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

Sorry buddy, I cant think of anything else which is going on wrong.


2009/12/14 Ren¨¦ Fournier

>
> PHP Version 5.3.0
>
> Directive Local Value Master Value
> allow_call_time_pass_reference Off Off
> allow_url_fopen On
>
>
> On 2009-12-14, at 12:26 AM, Gaurav Kumar wrote:
>
> What is the value for "allow_url_fopen ystem.configuration.php#ini.allow-url-fopen>"
> in your php.ini? It should be 1.
>
>
>
>
>
> 2009/12/13 Ren¨¦ Fournier
>
>> CURL works (remote and local)
>> file_get_contents() doesn't work (remote or local).
>>
>>
>>
>> On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:
>>
>> Ok Agreed.
>>
>> Lets do one last chance to ensure that your system is allowing external
>> connections or connection to other systems in the network-
>>
>> Use Curl to get in the file contents. Check your PHP that Curl is enable=
d.
>> Through phpinfo();
>>
>> If the script output the google page then this means that there is nothi=
ng
>> that is stopping you form getting in the content externally.
>>
>> >> // $str =3D file_get_contents ('http://www.google.com');
>> // echo $str;
>>
>>
>> // create a new cURL resource
>> $ch =3D curl_init();
>>
>> // set URL and other appropriate options
>> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in"); //
>> http://www.google.com
>> curl_setopt($ch, CURLOPT_HEADER, 0);
>>
>> // grab URL and pass it to the browser
>> curl_exec($ch);
>>
>> // close cURL resource, and free up system resources
>> curl_close($ch);
>>
>> ?>
>>
>> Thanks,
>>
>> Gaurav Kumar
>>
>>
>>
>> 2009/12/13 Ren¨¦ Fournier
>>
>>> The thing is, the file_get_contents() fails the same way on local URLs =
--
>>> that is, web sites hosted on the same machine. Or even using the machin=
e's
>>> own IP address.
>>>
>>> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>>>
>>> Hi Rene,
>>>
>>> The only thing which is a hurdle is that your system/computer is not
>>> allowing external connections. There seems to be nothing else wrong.
>>>
>>> I strongly suggest check your system firewall, any central server
>>> settings through which your system gets internet access, any antivirus =
s/w
>>> installed etc.. this can be the only reason. Something is stopping you =
to
>>> access external connection.
>>>
>>> Let me know when your problem is fixed.
>>> Also I tried the below code and it works fine-
>>>
>>> >>> $str =3D file_get_contents ('http://www.google.com');
>>> echo $str;
>>> ?>
>>>
>>> Thanks,
>>>
>>> Gaurav Kumar
>>>
>>>
>>>
>>> 2009/12/11 Ren¨¦ Fournier
>>>
>>>> Hi Gaurav,
>>>>
>>>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>>>
>>>> A very typical problem. Good you sent the error message.
>>>>
>>>> This problem can be caused due to one of the following-
>>>>
>>>> 1. I have faced similar problem due to local firewall settings.
>>>>
>>>>
>>>> Don't think this is it, since (1) the firewall settings haven't change=
d,
>>>> and (2) other machines on the same network can execute this same code =
and
>>>> function (but they aren't running OS X Server 10.6.
>>>>
>>>> 2. Try some other domain; i.e. other than google com. Try some of the
>>>> local area website with a particular page like
>>>> www.somedomain.com/somefile.html
>>>>
>>>>
>>>> I've tried many different external and local web sites, and they all
>>>> fail.
>>>>
>>>> 3. Some times the remote host does not allow you to connect to get the
>>>> file contents.
>>>>
>>>>
>>>> (Also not the cause -- as explained above.)
>>>>
>>>>
>>>> 4. # 3 can be either way round from both the ends a) you host server
>>>> does not allow external connections b) Remote host does not allow anon=
ymous
>>>> connection.
>>>>
>>>>
>>>> Thanks for the options. I don't think they apply in this case. If you
>>>> have any other suggestions on what to do, I would welcome them.
>>>>
>>>>
>>>>
>>>> Gaurav Kumar
>>>> blog.oswebstudio.com
>>>>
>>>>
>>>>
>>>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier om>wrote:
>>>>
>>>>> I thought error_reporting would display them, but I guess php.ini had
>>>>> them suppressed. Anyway, with:
>>>>>
>>>>> >>>>>
>>>>> error_reporting(-1);
>>>>> ini_set('display_errors', 1);
>>>>> set_time_limit(0);
>>>>> var_dump (file_get_contents ('http://www.google.com'));
>>>>>
>>>>> ?>
>>>>>
>>>>> I get:
>>>>>
>>>>> Warning: file_get_contents(http://www.google.com): failed to open
>>>>> stream: Operation now in progress in /____/____.php on line 7 bool(fa=
lse)
>>>>>
>>>>> Does that help with the diagnosis?
>>>>>
>>>>>
>>>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>>>
>>>>> > 2009/12/9 Ren¨¦ Fournier :
>>>>> >> It is, and I use curl elsewhere in the same script to fetch remote
>>>>> content.
>>>>> >> This exact same function works fine on my MacBook Pro (10.6 client=
,
>>>>> PHP 5.3), and *was* previously working fine under Server 10.4.11 and =
PHP
>>>>> 5.3,
>>>>> >>
>>>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>>>> >>
>>>>> >>> try
>>>>> >>> wget http://www.google.com in your command line to see whether th=
e
>>>>> network is reachable
>>>>> >>>
>>>>> >>> LinuxManMikeC wrote:
>>>>> >>>>
>>>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
>>>>> linuxmanmikec@gmail.com> wrote:
>>>>> >>>>
>>>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier <
>>>>> m5@renefournier.com> wrote:
>>>>> >>>>>
>>>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP
>>>>> 5.3. Any call of file_get_contents() on a local file works fine -- th=
e file
>>>>> is read and returned. But any call of file_get_contents on a url -- a=
ny url,
>>>>> local or remote -- always returns false.
>>>>> >>>>>>
>>>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/') www.google.com/%27%29>
>>>>> );
>>>>> >>>>>>
>>>>> >>>>>> bool(false)
>>>>> >>>>>>
>>>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>>>> >>>>>>
>>>>> >>>>>> allow_url_fopen =3D> On =3D> On
>>>>> >>>>>>
>>>>> >>>>>> Any ideas?
>>>>> >>>>>>
>>>>> >>>>>> ...Rene
>>>>> >>>>>>
>>>>> >>>>>
>>>>> http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-u=
rl-fopen
>>>>> >>>>>
>>>>> >>>>>
>>>>> >>>>
>>>>> >>>> "I've checked php.ini"
>>>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>>> >>>>
>>>>> >>>> --
>>>>> >>>> PHP General Mailing List (http://www.php.net/)
>>>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>> >>>>
>>>>> >>>>
>>>>> >>>
>>>>> >>> --
>>>>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =C9=
ÌÎñËÑË÷²=BF |
>>>>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>>>>> >>
>>>>> >>
>>>>> >
>>>>> > Do you have ANY errors/warning/notices?
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > -----
>>>>> > Richard Quadling
>>>>> > "Standing on the shoulders of some very clever giants!"
>>>>> > EE : http://www.experts-exchange.com/M_248814.html
>>>>> > Zend Certified Engineer :
>>>>> http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>>>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

--00504502b4683f06d1047ab0c5f1--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 14.12.2009 15:30:41 von m5

--Apple-Mail-24--973999793
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=GB2312

Well thanks for trying. For anyone reading this, who wants to be a hero =
and solve the impossible:

1. file_get_contents ($url) doesn't work -- (on remote URLs or =
local URLs)
2. file_get_contents ($file) works.
3. CURL works (on remote and local URLs).
4. as per php.ini, allow_url_fopen On

Xserve
- OS X Server 10.6.2
- PHP 5.3 (default)


So... it's as if PHP is not respecting the allow_url_fopen direction in =
php.ini. If that directive were set to Off, everything would make sense =
(files load, urls don't (local or remote)).

Anyone have anything to add? Anyone, anyone?

Bueller?


On 2009-12-14, at 10:05 PM, Gaurav Kumar wrote:

> Sorry buddy, I cant think of anything else which is going on wrong.
>=20
>=20
> 2009/12/14 Ren¨¦ Fournier
>=20
> PHP Version 5.3.0
>=20
> Directive Local Value Master Value
> allow_call_time_pass_reference Off Off
> allow_url_fopen On
>=20
>=20
> On 2009-12-14, at 12:26 AM, Gaurav Kumar wrote:
>=20
>> What is the value for "allow_url_fopen" in your php.ini? It should be =
1.
>>=20
>>=20
>>=20
>>=20
>>=20
>> 2009/12/13 Ren¨¦ Fournier
>> CURL works (remote and local)
>> file_get_contents() doesn't work (remote or local).
>>=20
>>=20
>>=20
>> On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:
>>=20
>>> Ok Agreed.=20
>>>=20
>>> Lets do one last chance to ensure that your system is allowing =
external connections or connection to other systems in the network-
>>>=20
>>> Use Curl to get in the file contents. Check your PHP that Curl is =
enabled. Through phpinfo();
>>>=20
>>> If the script output the google page then this means that there is =
nothing that is stopping you form getting in the content externally.
>>>=20
>>> >>> // $str =3D file_get_contents ('http://www.google.com');
>>> // echo $str;
>>>=20
>>>=20
>>> // create a new cURL resource
>>> $ch =3D curl_init();
>>>=20
>>> // set URL and other appropriate options
>>> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in"); =
//http://www.google.com
>>> curl_setopt($ch, CURLOPT_HEADER, 0);
>>>=20
>>> // grab URL and pass it to the browser
>>> curl_exec($ch);
>>>=20
>>> // close cURL resource, and free up system resources
>>> curl_close($ch);
>>>=20
>>> ?>
>>>=20
>>> Thanks,
>>>=20
>>> Gaurav Kumar
>>>=20
>>>=20
>>>=20
>>> 2009/12/13 Ren¨¦ Fournier
>>> The thing is, the file_get_contents() fails the same way on local =
URLs -- that is, web sites hosted on the same machine. Or even using the =
machine's own IP address.
>>>=20
>>> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>>>=20
>>>> Hi Rene,
>>>>=20
>>>> The only thing which is a hurdle is that your system/computer is =
not allowing external connections. There seems to be nothing else wrong.
>>>>=20
>>>> I strongly suggest check your system firewall, any central server =
settings through which your system gets internet access, any antivirus =
s/w installed etc.. this can be the only reason. Something is stopping =
you to access external connection.
>>>>=20
>>>> Let me know when your problem is fixed.
>>>> Also I tried the below code and it works fine-
>>>>=20
>>>> >>>> $str =3D file_get_contents ('http://www.google.com');
>>>> echo $str;
>>>> ?>
>>>>=20
>>>> Thanks,
>>>>=20
>>>> Gaurav Kumar
>>>>=20
>>>>=20
>>>>=20
>>>> 2009/12/11 Ren¨¦ Fournier
>>>> Hi Gaurav,
>>>>=20
>>>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>>>=20
>>>>> A very typical problem. Good you sent the error message.
>>>>>=20
>>>>> This problem can be caused due to one of the following-
>>>>>=20
>>>>> 1. I have faced similar problem due to local firewall settings.
>>>>=20
>>>> Don't think this is it, since (1) the firewall settings haven't =
changed, and (2) other machines on the same network can execute this =
same code and function (but they aren't running OS X Server 10.6.
>>>>=20
>>>>> 2. Try some other domain; i.e. other than google com. Try some of =
the local area website with a particular page like =
www.somedomain.com/somefile.html
>>>>=20
>>>> I've tried many different external and local web sites, and they =
all fail.
>>>>=20
>>>>> 3. Some times the remote host does not allow you to connect to get =
the file contents.
>>>>=20
>>>> (Also not the cause -- as explained above.)
>>>>=20
>>>>=20
>>>>> 4. # 3 can be either way round from both the ends a) you host =
server does not allow external connections b) Remote host does not allow =
anonymous connection.
>>>>=20
>>>> Thanks for the options. I don't think they apply in this case. If =
you have any other suggestions on what to do, I would welcome them.
>>>>=20
>>>>=20
>>>>=20
>>>>> Gaurav Kumar
>>>>> blog.oswebstudio.com
>>>>>=20
>>>>>=20
>>>>>=20
>>>>> On Thu, Dec 10, 2009 at 9:01 PM, Ren¨¦ Fournier =
wrote:
>>>>> I thought error_reporting would display them, but I guess php.ini =
had them suppressed. Anyway, with:
>>>>>=20
>>>>> >>>>>=20
>>>>> error_reporting(-1);
>>>>> ini_set('display_errors', 1);
>>>>> set_time_limit(0);
>>>>> var_dump (file_get_contents ('http://www.google.com'));
>>>>>=20
>>>>> ?>
>>>>>=20
>>>>> I get:
>>>>>=20
>>>>> Warning: file_get_contents(http://www.google.com): failed to open =
stream: Operation now in progress in /____/____.php on line 7 =
bool(false)
>>>>>=20
>>>>> Does that help with the diagnosis?
>>>>>=20
>>>>>=20
>>>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>>>=20
>>>>> > 2009/12/9 Ren¨¦ Fournier :
>>>>> >> It is, and I use curl elsewhere in the same script to fetch =
remote content.
>>>>> >> This exact same function works fine on my MacBook Pro (10.6 =
client, PHP 5.3), and *was* previously working fine under Server 10.4.11 =
and PHP 5.3,
>>>>> >>
>>>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>>>> >>
>>>>> >>> try
>>>>> >>> wget http://www.google.com in your command line to see whether =
the network is reachable
>>>>> >>>
>>>>> >>> LinuxManMikeC wrote:
>>>>> >>>>
>>>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC =
wrote:
>>>>> >>>>
>>>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, Ren¨¦ Fournier =
wrote:
>>>>> >>>>>
>>>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running =
PHP 5.3. Any call of file_get_contents() on a local file works fine -- =
the file is read and returned. But any call of file_get_contents on a =
url -- any url, local or remote -- always returns false.
>>>>> >>>>>>
>>>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>>>> >>>>>>
>>>>> >>>>>> bool(false)
>>>>> >>>>>>
>>>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>>>> >>>>>>
>>>>> >>>>>> allow_url_fopen =3D> On =3D> On
>>>>> >>>>>>
>>>>> >>>>>> Any ideas?
>>>>> >>>>>>
>>>>> >>>>>> ...Rene
>>>>> >>>>>>
>>>>> >>>>> =
http://us2.php.net/manual/en/filesystem.configuration.php#in i.allow-url-fo=
pen
>>>>> >>>>>
>>>>> >>>>>
>>>>> >>>>
>>>>> >>>> "I've checked php.ini"
>>>>> >>>> Right, must remember not to reply to stuff till I'm awake. =
:-D
>>>>> >>>>
>>>>> >>>> --
>>>>> >>>> PHP General Mailing List (http://www.php.net/)
>>>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>> >>>>
>>>>> >>>>
>>>>> >>>
>>>>> >>> --
>>>>> >>> <2866791487_dbbbdddf9e.jpg>»Ý ÐÂå· xinchen.hui | =
ÉÌÎñËÑË÷²¿ | (+8610)82602112-7974 | =
<2866349865_203e53a6c6.jpg>:laruence
>>>>> >>
>>>>> >>
>>>>> >
>>>>> > Do you have ANY errors/warning/notices?
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > -----
>>>>> > Richard Quadling
>>>>> > "Standing on the shoulders of some very clever giants!"
>>>>> > EE : http://www.experts-exchange.com/M_248814.html
>>>>> > Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
>>>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>>>=20
>>>>>=20
>>>>=20
>>>>=20
>>>=20
>>>=20
>>=20
>>=20
>=20
>=20


--Apple-Mail-24--973999793--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 14.12.2009 15:44:46 von cafer

René Fournier writes:

> 4. as per php.ini, allow_url_fopen On

Look at from phpinfo() the settings is already "On".

Best Regards.

--=20
Cafer Şimşek
DEV Staff Leader
http://pazar.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 14.12.2009 15:56:51 von m5

On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:

> René Fournier writes:
>=20
>> 4. as per php.ini, allow_url_fopen On
>=20
> Look at from phpinfo() the settings is already "On".

Yes, I know.

Which is why it's odd that the function fails on URLs.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents($url) returns false

am 14.12.2009 16:02:31 von Ashley Sheridan

--=-mf4quXOY3tSuf/cKnsEC
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2009-12-14 at 17:03 +0200, Cafer Şimşek wrote:

> René Fournier writes:
>=20
> > On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:
> >
> >> René Fournier writes:
> >>=20
> >>> 4. as per php.ini, allow_url_fopen On
> >>=20
> >> Look at from phpinfo() the settings is already "On".
> >
> > Yes, I know.
> >
> > Which is why it's odd that the function fails on URLs.
>=20
> try to get url content from any browser or (if you use Linux / Unix)
> curl.
>=20
> --=20
> Cafer Şimşek
> DEV Staff Leader
> http://pazar.com/
>=20


He already said Curl works, and changing the browser won't affect what
PHP is doing.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-mf4quXOY3tSuf/cKnsEC--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 14.12.2009 16:03:06 von cafer

René Fournier writes:

> On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:
>
>> René Fournier writes:
>>=20
>>> 4. as per php.ini, allow_url_fopen On
>>=20
>> Look at from phpinfo() the settings is already "On".
>
> Yes, I know.
>
> Which is why it's odd that the function fails on URLs.

try to get url content from any browser or (if you use Linux / Unix)
curl.

--=20
Cafer Şimşek
DEV Staff Leader
http://pazar.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 15.12.2009 16:55:29 von Richard Quadling

2009/12/14 Ashley Sheridan
>
> On Mon, 2009-12-14 at 17:03 +0200, Cafer Şimşek wrote:
>
> René Fournier writes:
>
> > On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:
> >
> >> René Fournier writes:
> >>
> >>> 4. as per php.ini, allow_url_fopen On
> >>
> >> Look at from phpinfo() the settings is already "On".
> >
> > Yes, I know.
> >
> > Which is why it's odd that the function fails on URLs.
>
> try to get url content from any browser or (if you use Linux / Unix)
> curl.
>
> --
> Cafer Şimşek
> DEV Staff Leader
> http://pazar.com/
>
>
> He already said Curl works, and changing the browser won't affect what PH=
P is doing.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

Do you have a default stream context defined for the http stream?

A _LONG_ time ago, when I was using a firewall with NTLM
authentication (which PHP doesn't deal with), I had to route all my
calls through a local proxy.

This was the code I had ...

// Define the default, system-wide context.
$r_default_context =3D stream_context_get_default(
array(
'http' =3D> array( // All HTTP requests are passed through the local
NTLM proxy server on port 8080.
'proxy' =3D> 'tcp://127.0.0.1:8080',
'request_fulluri' =3D> True,
),
)
);

// Though we said system wide, some extensions need a little coaxing.
libxml_set_streams_context($r_default_context);


Now, you may not see this in your code, but may be in a script which
is loaded via auto_prepend_file.

I would also suggest running something like WireShark at the same time
as your script. See if there is ANY traffic over the wire.

Do the cURL and file_get_contents() code generate identical requests?


--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 16.12.2009 04:05:34 von m5

--Apple-Mail-9--842306996
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii

On 2009-12-15, at 11:55 PM, Richard Quadling wrote:

> Do you have a default stream context defined for the http stream?

Nope.

>=20
> A _LONG_ time ago, when I was using a firewall with NTLM
> authentication (which PHP doesn't deal with), I had to route all my
> calls through a local proxy.
>=20
> This was the code I had ...
>=20
> > // Define the default, system-wide context.
> $r_default_context =3D stream_context_get_default(
> array(
> 'http' =3D> array( // All HTTP requests are passed =
through the local
> NTLM proxy server on port 8080.
> 'proxy' =3D> 'tcp://127.0.0.1:8080',
> 'request_fulluri' =3D> True,
> ),
> )
> );
>=20
> // Though we said system wide, some extensions need a little coaxing.
> libxml_set_streams_context($r_default_context);
>=20
>=20
> Now, you may not see this in your code, but may be in a script which
> is loaded via auto_prepend_file.

Wish it were, but my test code is bare bones.

>=20
> I would also suggest running something like WireShark at the same time
> as your script. See if there is ANY traffic over the wire.
>=20
> Do the cURL and file_get_contents() code generate identical requests?

cURL -- both PHP and command-line -- fetches files and URLs (remote and =
local) w/o issues. file_get_contents() fetches files, but fails on all =
URLs (remote and local). This is why I believe the problem lies with the =
machine's configuration and not the Firewall.

It's pretty confounding, isn't it? I'm not sure what to do at this =
point.

....Rene



--Apple-Mail-9--842306996--

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false

am 16.12.2009 05:49:23 von m5

--Apple-Mail-16--836077689
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii

On 2009-12-15, at 11:55 PM, Richard Quadling wrote:

> Do you have a default stream context defined for the http stream?

Nope.

>=20
> A _LONG_ time ago, when I was using a firewall with NTLM
> authentication (which PHP doesn't deal with), I had to route all my
> calls through a local proxy.
>=20
> This was the code I had ...
>=20
> > // Define the default, system-wide context.
> $r_default_context =3D stream_context_get_default(
> array(
> 'http' =3D> array( // All HTTP requests are passed =
through the local
> NTLM proxy server on port 8080.
> 'proxy' =3D> 'tcp://127.0.0.1:8080',
> 'request_fulluri' =3D> True,
> ),
> )
> );
>=20
> // Though we said system wide, some extensions need a little coaxing.
> libxml_set_streams_context($r_default_context);
>=20
>=20
> Now, you may not see this in your code, but may be in a script which
> is loaded via auto_prepend_file.

Wish it were, but my test code is bare bones.

>=20
> I would also suggest running something like WireShark at the same time
> as your script. See if there is ANY traffic over the wire.
>=20
> Do the cURL and file_get_contents() code generate identical requests?

cURL -- both PHP and command-line -- fetches files and URLs (remote and =
local) w/o issues. file_get_contents() fetches files, but fails on all =
URLs (remote and local). This is why I believe the problem lies with the =
machine's configuration and not the Firewall.

It's pretty confounding, isn't it? I'm not sure what to do at this =
point.

....Rene



--Apple-Mail-16--836077689--

Re: file_get_contents ($file) works -- file_get_contents ($url)

am 16.12.2009 11:14:26 von Richard Quadling

2009/12/16 René Fournier :
> On 2009-12-15, at 11:55 PM, Richard Quadling wrote:
>
> Do you have a default stream context defined for the http stream?
>
> Nope.
>
> A _LONG_ time ago, when I was using a firewall with NTLM
> authentication (which PHP doesn't deal with), I had to route all my
> calls through a local proxy.
>
> This was the code I had ...
>
> > // Define the default, system-wide context.
> $r_default_context =3D stream_context_get_default(
> array(
> 'http' =3D> array( // All HTTP requests are passed through the local
> NTLM proxy server on port 8080.
> 'proxy' =3D> 'tcp://127.0.0.1:8080',
> 'request_fulluri' =3D> True,
> ),
> )
> );
>
> // Though we said system wide, some extensions need a little coaxing.
> libxml_set_streams_context($r_default_context);
>
>
> Now, you may not see this in your code, but may be in a script which
> is loaded via auto_prepend_file.
>
> Wish it were, but my test code is bare bones.
>
> I would also suggest running something like WireShark at the same time
> as your script. See if there is ANY traffic over the wire.
>
> Do the cURL and file_get_contents() code generate identical requests?
>
> cURL -- both PHP and command-line -- fetches files and URLs (remote and
> local) w/o issues. file_get_contents() fetches files, but fails on all UR=
Ls
> (remote and local). This is why I believe the problem lies with the
> machine's configuration and not the Firewall.
> It's pretty confounding, isn't it? I'm not sure what to do at this point.
> ...Rene
>
>

But by using something like WireShark you can see exactly what
requests ARE being made. You may be getting a redirect reply which is
failing or something daft. Anything really.



--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php