Solved

File_get_contents for a passworded page

Posted on 2006-10-26
3
201 Views
Last Modified: 2008-03-17
Hi all,
I used to use

file_get_contents("http://username:password@site.com"); to get pages that were password protected, however recently im getting 401 errors, does anyone know another way of doing this?

0
Comment
Question by:fox_statton
  • 2
3 Comments
 
LVL 18

Expert Comment

by:ingwa
ID: 17816593
If it's a password protected website, chances are they have passworded it to protect the content contained therein and don't want the information splashed about the place.  

Such activities, or obtaining information that someone else has protected for some such reason are considered hacking.  We experts at EE respect other peoples wishes, and don't infringe on such protections, and our personal ethics prohibit that too.  If you are allowed to view and access such content for external presentation, then the site owners will be able to provide you with the means to present that information on your own application with code that they are happy with.  Other than that, from what I understand, experts at EE will not be able to assist you further.

See the following pages for more information:

http://www.experts-exchange.com/memberAgreement.jsp
http://www.experts-exchange.com/help.jsp
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 498 total points
ID: 17817247
hi,

  if you used that code and it was working, then the error 401 now means that the access using that way has been blocked on some point of the way (for whatever reason).
  you should contact the owners/admins of the site.com to check with them, because there is no other way.
  opening a page over http works only like that.

angelIII, page editor
0
 
LVL 18

Expert Comment

by:ingwa
ID: 17823953
Hmm, fox, it appears that I may have missinterpreted your question some how, which lead me to answering in the way that I did.  It does appear after further review that you were able to perform the actions you wanted to do in a password protected environment, but as Angel has stated, things seem to have changed to the incompatability of your script.  Contact the web master or developer(s) of the website you are trying to obtain information from and see how their code has chaged.  Change your script(s) to fit their new way and things should function as normal.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now