fopen with URL *never* fails [message #172549] |
Mon, 21 February 2011 19:33 |
acoleman616
Messages: 2 Registered: February 2011
Karma: 0
|
Junior Member |
|
|
Hi all,
I'm at a loss. I'm calling fopen(), passing it absolute URLs, and
when the URLs are from one, and only one, of my public domains, no
matter what URL I pass, it *always* executes successfully. So even if
I pass it a URL of a file that I *know* doesn't exist, fopen() still
executes and does *not* return false, as it should.
Any ideas?
Thanks in advance for any help.
|
|
|
Re: fopen with URL *never* fails [message #172551 is a reply to message #172549] |
Mon, 21 February 2011 19:36 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 2/21/2011 2:33 PM, acoleman616 wrote:
> Hi all,
>
> I'm at a loss. I'm calling fopen(), passing it absolute URLs, and
> when the URLs are from one, and only one, of my public domains, no
> matter what URL I pass, it *always* executes successfully. So even if
> I pass it a URL of a file that I *know* doesn't exist, fopen() still
> executes and does *not* return false, as it should.
>
> Any ideas?
>
> Thanks in advance for any help.
Check what is returned - it's probably a "Page Not Found" page, so the
fopen() completed.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: fopen with URL *never* fails [message #172558 is a reply to message #172551] |
Mon, 21 February 2011 20:38 |
acoleman616
Messages: 2 Registered: February 2011
Karma: 0
|
Junior Member |
|
|
On Feb 21, 2:36 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 2/21/2011 2:33 PM, acoleman616 wrote:
>
>> Hi all,
>
>> I'm at a loss. I'm calling fopen(), passing it absolute URLs, and
>> when the URLs are from one, and only one, of my public domains, no
>> matter what URL I pass, it *always* executes successfully. So even if
>> I pass it a URL of a file that I *know* doesn't exist, fopen() still
>> executes and does *not* return false, as it should.
>
>> Any ideas?
>
>> Thanks in advance for any help.
>
> Check what is returned - it's probably a "Page Not Found" page, so the
> fopen() completed.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
Ah, didn't think of that. Is there any way to detect if a 404 is
returned from the original URL passed to it?
|
|
|
Re: fopen with URL *never* fails [message #172564 is a reply to message #172558] |
Mon, 21 February 2011 21:48 |
Robert Heller
Messages: 60 Registered: December 2010
Karma: 0
|
Member |
|
|
At Mon, 21 Feb 2011 12:38:03 -0800 (PST) acoleman616 <acoleman616(at)gmail(dot)com> wrote:
>
> On Feb 21, 2:36=A0pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> On 2/21/2011 2:33 PM, acoleman616 wrote:
>>
>>> Hi all,
>>
>>> I'm at a loss. =A0I'm calling fopen(), passing it absolute URLs, and
>>> when the URLs are from one, and only one, of my public domains, no
>>> matter what URL I pass, it *always* executes successfully. =A0So even i=
> f
>>> I pass it a URL of a file that I *know* doesn't exist, fopen() still
>>> executes and does *not* return false, as it should.
>>
>>> Any ideas?
>>
>>> Thanks in advance for any help.
>>
>> Check what is returned - it's probably a "Page Not Found" page, so the
>> fopen() completed.
>>
>> --
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Ah, didn't think of that. Is there any way to detect if a 404 is
> returned from the original URL passed to it?
Even more likely than a 404, would be 302. *Some* CMS's return 302
status codes for URLs that 'don't exist' and redirect you to like the
home page or a search page or something. A 302 is NOT an error, it is
just a redirection to someplace else, therefor a URL fopen wouldn't
fail, it would open whatever the URL on Location: header pointed to.
>
--
Robert Heller -- 978-544-6933 / heller(at)deepsoft(dot)com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
|
|
|
Re: fopen with URL *never* fails [message #172567 is a reply to message #172558] |
Mon, 21 February 2011 23:43 |
Captain Paralytic
Messages: 204 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Feb 21, 8:38 pm, acoleman616 <acoleman...@gmail.com> wrote:
> On Feb 21, 2:36 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>
>
>
>
>
>> On 2/21/2011 2:33 PM, acoleman616 wrote:
>
>>> Hi all,
>
>>> I'm at a loss. I'm calling fopen(), passing it absolute URLs, and
>>> when the URLs are from one, and only one, of my public domains, no
>>> matter what URL I pass, it *always* executes successfully. So even if
>>> I pass it a URL of a file that I *know* doesn't exist, fopen() still
>>> executes and does *not* return false, as it should.
>
>>> Any ideas?
>
>>> Thanks in advance for any help.
>
>> Check what is returned - it's probably a "Page Not Found" page, so the
>> fopen() completed.
>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Ah, didn't think of that. Is there any way to detect if a 404 is
> returned from the original URL passed to it?
Use CURL instead.
|
|
|
Re: fopen with URL *never* fails [message #172618 is a reply to message #172558] |
Tue, 22 February 2011 09:09 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 2/21/2011 9:38 PM, acoleman616 wrote:
> On Feb 21, 2:36 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 2/21/2011 2:33 PM, acoleman616 wrote:
>>
>>> Hi all,
>>
>>> I'm at a loss. I'm calling fopen(), passing it absolute URLs, and
>>> when the URLs are from one, and only one, of my public domains, no
>>> matter what URL I pass, it *always* executes successfully. So even if
>>> I pass it a URL of a file that I *know* doesn't exist, fopen() still
>>> executes and does *not* return false, as it should.
>>
>>> Any ideas?
>>
>>> Thanks in advance for any help.
>>
>> Check what is returned - it's probably a "Page Not Found" page, so the
>> fopen() completed.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Ah, didn't think of that. Is there any way to detect if a 404 is
> returned from the original URL passed to it?
Hi,
Have a look at: get_headers($url)
http://nl3.php.net/manual/en/function.get-headers.php
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|