Solved

File_get_contents for a passworded page

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I want to echo out my field names with its values into a table 10 34
PHP and google maps 13 47
maybe no no httpd.conf 6 48
Showing random records from database 10 37
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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.

825 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