Solved

File_get_contents for a passworded page

Posted on 2006-10-26
3
213 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can i modify my File download link ? 6 49
PHPStorm debugging issues 1 25
test if query has no results 2 19
PHP populating an array. 4 5
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will learn how to count occurrences of each item in an array.

863 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

20 Experts available now in Live!

Get 1:1 Help Now