Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file_get_contents php 4.4.4 no cURL

Status
Not open for further replies.

JeffSChilders

Programmer
Jan 13, 2012
5
US
First off there is no copy issue with the scraping of this page. The site I am working on is a subdomain.

Using the following code:
Code:
...
$url = '[URL unfurl="true"]http://www.outlands.org/Portals/0/event_cal.php';[/URL] 
$fp = file_get_contents($url);
echo $fp;
...
error: failed to open stream: Bad file descriptor

If I replace with all is well and the page is displayed. I presume that it has something to do with how it is requesting the page since a web browser will display the page.

Considering these limitations of the tools at hand, no curl and older php. Is there a way I can get this page? I am not tied to file_get_contents() method. Any working solution would be greatly appreciated.
 
I can get your page from my laptop using file_get_contents.

I'm confused by the error message of 'bad file descriptor'. Perhaps you need to upgrade your version of php4 as this was a known bug on some (very) old version of php. Might it have crept back in?

but also the bit after the colon is the message passed to php by your OS. so also make sure that your OS is fully patched and up to date. This alone could explain why I can get your file from here (the work is done on the client machine) and you cannot. Although the fact that you can attach to some pages via fopen using the http stream and not others is confusing.

Another potential issue is DNS. if the site is inside your domain then is it possible that your internal DNS is routing your request incorrectly?

you say that you do not have curl but you don't say what OS you have, nor whether you have root access. We may be able to assist more if you can get to a root terminal.

lastly - consider upgrading to php 5.3.9 . Php 4 is no longer supported by the php community.

 
jpadie - you are not as confused as I.

Yes the server is out of date... and php info says 'Microsoft-IIS/6.0'

DNS is resolving because a link resolves correctly from that page. The main website is using a old DNN install which might be tweaking the url. Also one of the reasons upgrading is feared. Breaking 30+ websites to upgrade at this point isn't a viable option.

I don't have root access or even terminal ability.

I wish I had a job that I could tell the bosses they use old software and to piss off until they upgrade and still have said job lol.

Thanks for your time anyway. Ill write a service to scrape, parse, and ftp my code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top