?
Solved

File_get_contents for a passworded page

Posted on 2006-10-26
3
Medium Priority
?
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Mark Gilbert
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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1992 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:Mark Gilbert
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 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