Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7515 > unrolled thread
| Started by | Charlie <shymathguy@gmail.com> |
|---|---|
| First post | 2012-11-10 12:06 -0800 |
| Last post | 2012-11-12 14:11 +0100 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.php
file_get_contents doesn’t access one URL Charlie <shymathguy@gmail.com> - 2012-11-10 12:06 -0800
Re: file_get_contents doesn’t access one URL Luuk <luuk@invalid.lan> - 2012-11-10 21:19 +0100
Re: file_get_contents doesn’t access one URL Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-12 13:38 +0000
Re: file_get_contents doesn’t access one URL Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-12 08:51 -0500
Re: file_get_contents doesn’t access one URL Chuck Anderson <cycletourist@invalid.invalid> - 2012-11-12 14:01 -0700
Re: file_get_contents doesn’t access one URL Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-12 17:13 -0500
Re: file_get_contents doesn’t access one URL Chuck Anderson <cycletourist@invalid.invalid> - 2012-11-12 18:13 -0700
Re: file_get_contents doesn’t access one URL Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 08:49 -0500
Re: file_get_contents doesn't access one URL "Alex vdB" <alex@invalid> - 2012-11-12 14:11 +0100
| From | Charlie <shymathguy@gmail.com> |
|---|---|
| Date | 2012-11-10 12:06 -0800 |
| Subject | file_get_contents doesn’t access one URL |
| Message-ID | <9d2b587e-ec50-47cf-bec8-97b6b47c60e4@k6g2000vbr.googlegroups.com> |
http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache-DBA.aspx The above is a legitimate URL that I can access by copying it into the address field of my browser. However, as an argument to file_get_contents I get the error message, Warning: file_get_contents(http://www.philadelphia.careerboard.com/job/ 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found Any help would be appreciated. Charlie
[toc] | [next] | [standalone]
| From | Luuk <luuk@invalid.lan> |
|---|---|
| Date | 2012-11-10 21:19 +0100 |
| Message-ID | <cfp2n9-19p.ln1@luuk.invalid.lan> |
| In reply to | #7515 |
On 10-11-2012 21:06, Charlie wrote: > http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache-DBA.aspx > > The above is a legitimate URL that I can access by copying it into the > address field of my browser. However, as an argument to > file_get_contents I get the error message, > > Warning: file_get_contents(http://www.philadelphia.careerboard.com/job/ > 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: failed > to open stream: HTTP request failed! HTTP/1.1 404 Not Found > > Any help would be appreciated. > > Charlie > When i visit the page, AND debug this site using Fiddler* i see a 404 too. *Fiddler: http://www.fiddler2.com
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2012-11-12 13:38 +0000 |
| Message-ID | <k7qu46$q3v$1@dont-email.me> |
| In reply to | #7516 |
On Sat, 10 Nov 2012 21:19:29 +0100, Luuk wrote: > On 10-11-2012 21:06, Charlie wrote: >> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- DBA.aspx >> >> The above is a legitimate URL that I can access by copying it into the >> address field of my browser. However, as an argument to >> file_get_contents I get the error message, >> >> Warning: file_get_contents(http://www.philadelphia.careerboard.com/job/ >> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: failed to >> open stream: HTTP request failed! HTTP/1.1 404 Not Found > When i visit the page, AND debug this site using Fiddler* i see a 404 > too. Firefox sees a web page. Wget sees a 301 redirect followed by a 404: $ wget http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- DBA.aspx --2012-11-12 13:28:57-- http://www.philadelphia.careerboard.com/ job/3167962-MUMPS~2FCache-DBA.aspx Resolving www.philadelphia.careerboard.com (www.philadelphia.careerboard.com)... 64.74.112.101 Connecting to www.philadelphia.careerboard.com (www.philadelphia.careerboard.com)|64.74.112.101|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- DBA.aspx [following] --2012-11-12 13:28:57-- http://philadelphia.careerboard.com/job/3167962- MUMPS~2FCache-DBA.aspx Resolving philadelphia.careerboard.com (philadelphia.careerboard.com)... 64.74.112.101 Connecting to philadelphia.careerboard.com (philadelphia.careerboard.com)| 64.74.112.101|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2012-11-12 13:28:57 ERROR 404: Not Found. Rgds Denis McMahon
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-11-12 08:51 -0500 |
| Message-ID | <k7qusf$eip$1@dont-email.me> |
| In reply to | #7532 |
On 11/12/2012 8:38 AM, Denis McMahon wrote: > On Sat, 10 Nov 2012 21:19:29 +0100, Luuk wrote: > >> On 10-11-2012 21:06, Charlie wrote: >>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- > DBA.aspx >>> >>> The above is a legitimate URL that I can access by copying it into the >>> address field of my browser. However, as an argument to >>> file_get_contents I get the error message, >>> >>> Warning: file_get_contents(http://www.philadelphia.careerboard.com/job/ >>> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: failed to >>> open stream: HTTP request failed! HTTP/1.1 404 Not Found > >> When i visit the page, AND debug this site using Fiddler* i see a 404 >> too. > > Firefox sees a web page. Wget sees a 301 redirect followed by a 404: > > $ wget http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- > DBA.aspx > --2012-11-12 13:28:57-- http://www.philadelphia.careerboard.com/ > job/3167962-MUMPS~2FCache-DBA.aspx > Resolving www.philadelphia.careerboard.com > (www.philadelphia.careerboard.com)... 64.74.112.101 > Connecting to www.philadelphia.careerboard.com > (www.philadelphia.careerboard.com)|64.74.112.101|:80... connected. > HTTP request sent, awaiting response... 301 Moved Permanently > Location: http://philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- > DBA.aspx [following] > --2012-11-12 13:28:57-- http://philadelphia.careerboard.com/job/3167962- > MUMPS~2FCache-DBA.aspx > Resolving philadelphia.careerboard.com (philadelphia.careerboard.com)... > 64.74.112.101 > Connecting to philadelphia.careerboard.com (philadelphia.careerboard.com)| > 64.74.112.101|:80... connected. > HTTP request sent, awaiting response... 404 Not Found > 2012-11-12 13:28:57 ERROR 404: Not Found. > > Rgds > > Denis McMahon > Denis, Not quite. Firefox gets the same 301 and 404. But FF loads some Javascript (must be part of the 404 error page) and continues processing from there. They are obviously doing what they can to prevent people from doing just what the op is trying to do. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Chuck Anderson <cycletourist@invalid.invalid> |
|---|---|
| Date | 2012-11-12 14:01 -0700 |
| Message-ID | <k7ro2r$u07$1@dont-email.me> |
| In reply to | #7534 |
Jerry Stuckle wrote: > On 11/12/2012 8:38 AM, Denis McMahon wrote: >> On Sat, 10 Nov 2012 21:19:29 +0100, Luuk wrote: >> >>> On 10-11-2012 21:06, Charlie wrote: >>>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >> DBA.aspx >>>> >>>> The above is a legitimate URL that I can access by copying it into the >>>> address field of my browser. However, as an argument to >>>> file_get_contents I get the error message, >>>> >>>> Warning: >>>> file_get_contents(http://www.philadelphia.careerboard.com/job/ >>>> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: >>>> failed to >>>> open stream: HTTP request failed! HTTP/1.1 404 Not Found >> >>> When i visit the page, AND debug this site using Fiddler* i see a 404 >>> too. >> >> Firefox sees a web page. Wget sees a 301 redirect followed by a 404: >> >> $ wget >> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >> DBA.aspx >> --2012-11-12 13:28:57-- http://www.philadelphia.careerboard.com/ >> job/3167962-MUMPS~2FCache-DBA.aspx >> Resolving www.philadelphia.careerboard.com >> (www.philadelphia.careerboard.com)... 64.74.112.101 >> Connecting to www.philadelphia.careerboard.com >> (www.philadelphia.careerboard.com)|64.74.112.101|:80... connected. >> HTTP request sent, awaiting response... 301 Moved Permanently >> Location: http://philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >> DBA.aspx [following] >> --2012-11-12 13:28:57-- >> http://philadelphia.careerboard.com/job/3167962- >> MUMPS~2FCache-DBA.aspx >> Resolving philadelphia.careerboard.com (philadelphia.careerboard.com)... >> 64.74.112.101 >> Connecting to philadelphia.careerboard.com >> (philadelphia.careerboard.com)| >> 64.74.112.101|:80... connected. >> HTTP request sent, awaiting response... 404 Not Found >> 2012-11-12 13:28:57 ERROR 404: Not Found. >> >> Rgds >> >> Denis McMahon >> > > Denis, > > Not quite. Firefox gets the same 301 and 404. But FF loads some > Javascript (must be part of the 404 error page) and continues > processing from there. > > They are obviously doing what they can to prevent people from doing > just what the op is trying to do. > I have Javascript disabled and the page still loads in Firefox. Could it have anything to do with using an HttpOnly cookie? HTTP/1.1 404 Not Found Date: Mon, 12 Nov 2012 20:56:50 GMT ... Set-Cookie: ASP.NET_SessionId=kyj2do654xkl2auwhtsjrvyo; path=/; HttpOnly ... From http://php.net/manual/en/function.setcookie.php When TRUE the cookie will be made accessible only through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. It has been suggested that this setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers), but that claim is often disputed. Added in PHP 5.2.0. TRUE or FALSE -- ***************************** Chuck Anderson • Boulder, CO http://cycletourist.com Turn Off, Tune Out, Drop In *****************************
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-11-12 17:13 -0500 |
| Message-ID | <k7rsbi$pss$1@dont-email.me> |
| In reply to | #7538 |
On 11/12/2012 4:01 PM, Chuck Anderson wrote: > Jerry Stuckle wrote: >> On 11/12/2012 8:38 AM, Denis McMahon wrote: >>> On Sat, 10 Nov 2012 21:19:29 +0100, Luuk wrote: >>> >>>> On 10-11-2012 21:06, Charlie wrote: >>>>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>> DBA.aspx >>>>> >>>>> The above is a legitimate URL that I can access by copying it into the >>>>> address field of my browser. However, as an argument to >>>>> file_get_contents I get the error message, >>>>> >>>>> Warning: >>>>> file_get_contents(http://www.philadelphia.careerboard.com/job/ >>>>> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: >>>>> failed to >>>>> open stream: HTTP request failed! HTTP/1.1 404 Not Found >>> >>>> When i visit the page, AND debug this site using Fiddler* i see a 404 >>>> too. >>> >>> Firefox sees a web page. Wget sees a 301 redirect followed by a 404: >>> >>> $ wget >>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>> DBA.aspx >>> --2012-11-12 13:28:57-- http://www.philadelphia.careerboard.com/ >>> job/3167962-MUMPS~2FCache-DBA.aspx >>> Resolving www.philadelphia.careerboard.com >>> (www.philadelphia.careerboard.com)... 64.74.112.101 >>> Connecting to www.philadelphia.careerboard.com >>> (www.philadelphia.careerboard.com)|64.74.112.101|:80... connected. >>> HTTP request sent, awaiting response... 301 Moved Permanently >>> Location: http://philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>> DBA.aspx [following] >>> --2012-11-12 13:28:57-- http://philadelphia.careerboard.com/job/3167962- >>> MUMPS~2FCache-DBA.aspx >>> Resolving philadelphia.careerboard.com (philadelphia.careerboard.com)... >>> 64.74.112.101 >>> Connecting to philadelphia.careerboard.com >>> (philadelphia.careerboard.com)| >>> 64.74.112.101|:80... connected. >>> HTTP request sent, awaiting response... 404 Not Found >>> 2012-11-12 13:28:57 ERROR 404: Not Found. >>> >>> Rgds >>> >>> Denis McMahon >>> >> >> Denis, >> >> Not quite. Firefox gets the same 301 and 404. But FF loads some >> Javascript (must be part of the 404 error page) and continues >> processing from there. >> >> They are obviously doing what they can to prevent people from doing >> just what the op is trying to do. >> > > I have Javascript disabled and the page still loads in Firefox. > > Could it have anything to do with using an HttpOnly cookie? > > HTTP/1.1 404 Not Found > Date: Mon, 12 Nov 2012 20:56:50 GMT > ... > Set-Cookie: ASP.NET_SessionId=kyj2do654xkl2auwhtsjrvyo; path=/; HttpOnly > ... > > From http://php.net/manual/en/function.setcookie.php > > When TRUE the cookie will be made accessible only through the HTTP > protocol. This means that the cookie won't be accessible by scripting > languages, such as JavaScript. It has been suggested that this setting > can effectively help to reduce identity theft through XSS attacks > (although it is not supported by all browsers), but that claim is often > disputed. Added in PHP 5.2.0. TRUE or FALSE > I didn't actually try it with javascript disabled - I just looked at the headers. But it obviously is an attempt to not allow just what you're trying to do. Do you have the owner's permission to access the page via a script? If so, the webmaster should be able to help you. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Chuck Anderson <cycletourist@invalid.invalid> |
|---|---|
| Date | 2012-11-12 18:13 -0700 |
| Message-ID | <k7s6rh$q6j$1@dont-email.me> |
| In reply to | #7539 |
Jerry Stuckle wrote: > On 11/12/2012 4:01 PM, Chuck Anderson wrote: >> Jerry Stuckle wrote: >>> On 11/12/2012 8:38 AM, Denis McMahon wrote: >>>> On Sat, 10 Nov 2012 21:19:29 +0100, Luuk wrote: >>>> >>>>> On 10-11-2012 21:06, Charlie wrote: >>>>>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>>> DBA.aspx >>>>>> >>>>>> The above is a legitimate URL that I can access by copying it >>>>>> into the >>>>>> address field of my browser. However, as an argument to >>>>>> file_get_contents I get the error message, >>>>>> >>>>>> Warning: >>>>>> file_get_contents(http://www.philadelphia.careerboard.com/job/ >>>>>> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: >>>>>> failed to >>>>>> open stream: HTTP request failed! HTTP/1.1 404 Not Found >>>> >>>>> When i visit the page, AND debug this site using Fiddler* i see a 404 >>>>> too. >>>> >>>> Firefox sees a web page. Wget sees a 301 redirect followed by a 404: >>>> >>>> $ wget >>>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>>> DBA.aspx >>>> --2012-11-12 13:28:57-- http://www.philadelphia.careerboard.com/ >>>> job/3167962-MUMPS~2FCache-DBA.aspx >>>> Resolving www.philadelphia.careerboard.com >>>> (www.philadelphia.careerboard.com)... 64.74.112.101 >>>> Connecting to www.philadelphia.careerboard.com >>>> (www.philadelphia.careerboard.com)|64.74.112.101|:80... connected. >>>> HTTP request sent, awaiting response... 301 Moved Permanently >>>> Location: >>>> http://philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>>> DBA.aspx [following] >>>> --2012-11-12 13:28:57-- >>>> http://philadelphia.careerboard.com/job/3167962- >>>> MUMPS~2FCache-DBA.aspx >>>> Resolving philadelphia.careerboard.com >>>> (philadelphia.careerboard.com)... >>>> 64.74.112.101 >>>> Connecting to philadelphia.careerboard.com >>>> (philadelphia.careerboard.com)| >>>> 64.74.112.101|:80... connected. >>>> HTTP request sent, awaiting response... 404 Not Found >>>> 2012-11-12 13:28:57 ERROR 404: Not Found. >>>> >>>> Rgds >>>> >>>> Denis McMahon >>>> >>> >>> Denis, >>> >>> Not quite. Firefox gets the same 301 and 404. But FF loads some >>> Javascript (must be part of the 404 error page) and continues >>> processing from there. >>> >>> They are obviously doing what they can to prevent people from doing >>> just what the op is trying to do. >>> >> >> I have Javascript disabled and the page still loads in Firefox. >> >> Could it have anything to do with using an HttpOnly cookie? >> >> HTTP/1.1 404 Not Found >> Date: Mon, 12 Nov 2012 20:56:50 GMT >> ... >> Set-Cookie: ASP.NET_SessionId=kyj2do654xkl2auwhtsjrvyo; path=/; HttpOnly >> ... >> >> From http://php.net/manual/en/function.setcookie.php >> >> When TRUE the cookie will be made accessible only through the HTTP >> protocol. This means that the cookie won't be accessible by scripting >> languages, such as JavaScript. It has been suggested that this setting >> can effectively help to reduce identity theft through XSS attacks >> (although it is not supported by all browsers), but that claim is often >> disputed. Added in PHP 5.2.0. TRUE or FALSE >> > > I didn't actually try it with javascript disabled - I just looked at > the headers. But it obviously is an attempt to not allow just what > you're trying to do. > > Do you have the owner's permission to access the page via a script? > If so, the webmaster should be able to help you. > I am not the OP. I am merely speculating on how it is done. -- ***************************** Chuck Anderson • Boulder, CO http://cycletourist.com Turn Off, Tune Out, Drop In *****************************
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-11-13 08:49 -0500 |
| Message-ID | <k7tj56$bvk$1@dont-email.me> |
| In reply to | #7540 |
On 11/12/2012 8:13 PM, Chuck Anderson wrote: > Jerry Stuckle wrote: >> On 11/12/2012 4:01 PM, Chuck Anderson wrote: >>> Jerry Stuckle wrote: >>>> On 11/12/2012 8:38 AM, Denis McMahon wrote: >>>>> On Sat, 10 Nov 2012 21:19:29 +0100, Luuk wrote: >>>>> >>>>>> On 10-11-2012 21:06, Charlie wrote: >>>>>>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>>>> DBA.aspx >>>>>>> >>>>>>> The above is a legitimate URL that I can access by copying it >>>>>>> into the >>>>>>> address field of my browser. However, as an argument to >>>>>>> file_get_contents I get the error message, >>>>>>> >>>>>>> Warning: >>>>>>> file_get_contents(http://www.philadelphia.careerboard.com/job/ >>>>>>> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: >>>>>>> failed to >>>>>>> open stream: HTTP request failed! HTTP/1.1 404 Not Found >>>>> >>>>>> When i visit the page, AND debug this site using Fiddler* i see a 404 >>>>>> too. >>>>> >>>>> Firefox sees a web page. Wget sees a 301 redirect followed by a 404: >>>>> >>>>> $ wget >>>>> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>>>> DBA.aspx >>>>> --2012-11-12 13:28:57-- http://www.philadelphia.careerboard.com/ >>>>> job/3167962-MUMPS~2FCache-DBA.aspx >>>>> Resolving www.philadelphia.careerboard.com >>>>> (www.philadelphia.careerboard.com)... 64.74.112.101 >>>>> Connecting to www.philadelphia.careerboard.com >>>>> (www.philadelphia.careerboard.com)|64.74.112.101|:80... connected. >>>>> HTTP request sent, awaiting response... 301 Moved Permanently >>>>> Location: >>>>> http://philadelphia.careerboard.com/job/3167962-MUMPS~2FCache- >>>>> DBA.aspx [following] >>>>> --2012-11-12 13:28:57-- >>>>> http://philadelphia.careerboard.com/job/3167962- >>>>> MUMPS~2FCache-DBA.aspx >>>>> Resolving philadelphia.careerboard.com >>>>> (philadelphia.careerboard.com)... >>>>> 64.74.112.101 >>>>> Connecting to philadelphia.careerboard.com >>>>> (philadelphia.careerboard.com)| >>>>> 64.74.112.101|:80... connected. >>>>> HTTP request sent, awaiting response... 404 Not Found >>>>> 2012-11-12 13:28:57 ERROR 404: Not Found. >>>>> >>>>> Rgds >>>>> >>>>> Denis McMahon >>>>> >>>> >>>> Denis, >>>> >>>> Not quite. Firefox gets the same 301 and 404. But FF loads some >>>> Javascript (must be part of the 404 error page) and continues >>>> processing from there. >>>> >>>> They are obviously doing what they can to prevent people from doing >>>> just what the op is trying to do. >>>> >>> >>> I have Javascript disabled and the page still loads in Firefox. >>> >>> Could it have anything to do with using an HttpOnly cookie? >>> >>> HTTP/1.1 404 Not Found >>> Date: Mon, 12 Nov 2012 20:56:50 GMT >>> ... >>> Set-Cookie: ASP.NET_SessionId=kyj2do654xkl2auwhtsjrvyo; path=/; HttpOnly >>> ... >>> >>> From http://php.net/manual/en/function.setcookie.php >>> >>> When TRUE the cookie will be made accessible only through the HTTP >>> protocol. This means that the cookie won't be accessible by scripting >>> languages, such as JavaScript. It has been suggested that this setting >>> can effectively help to reduce identity theft through XSS attacks >>> (although it is not supported by all browsers), but that claim is often >>> disputed. Added in PHP 5.2.0. TRUE or FALSE >>> >> >> I didn't actually try it with javascript disabled - I just looked at >> the headers. But it obviously is an attempt to not allow just what >> you're trying to do. >> >> Do you have the owner's permission to access the page via a script? If >> so, the webmaster should be able to help you. >> > > I am not the OP. I am merely speculating on how it is done. > Not only is it off-topic in this newsgroup, but I don't like to discuss security implementations (especially someone else's) in a public forum. Sorry. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Alex vdB" <alex@invalid> |
|---|---|
| Date | 2012-11-12 14:11 +0100 |
| Subject | Re: file_get_contents doesn't access one URL |
| Message-ID | <a9210$50a0f574$5353c82b$19960@cache50.multikabel.net> |
| In reply to | #7515 |
"Charlie" <shymathguy@gmail.com> schreef in bericht
news:9d2b587e-ec50-47cf-bec8-97b6b47c60e4@k6g2000vbr.googlegroups.com...
> http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache-DBA.aspx
>
> The above is a legitimate URL that I can access by copying it into the
> address field of my browser. However, as an argument to
> file_get_contents I get the error message,
>
> Warning: file_get_contents(http://www.philadelphia.careerboard.com/job/
> 3167962-MUMPS~2FCache-DBA.aspx) [function.file-get-contents]: failed
> to open stream: HTTP request failed! HTTP/1.1 404 Not Found
>
> Any help would be appreciated.
Two possible problems to investigate:
1: '/' is url-encoded ('~2F'). What happens if you don't do that?
2: you may have to send a 'host:' header:
(example copied from the php site and modified)
<?php
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Host: www.philadelphia.careerboard.com\r\n"
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file =
file_get_contents('http://www.philadelphia.careerboard.com/job/3167962-MUMPS~2FCache-DBA.aspx',
false, $context);
?>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web