Faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

48 of 57 people (84%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How do I retrieve pasword protected area with PHP?

Dec 3rd, 2004 08:51
Edwin Chan, Aziem Hassan,


Try the following:
<?php
  // declare the protected link details
  $protected_userid = "abc";
  $protected_passwd = "cde";
  $protected_url    = "www.abc.com/protected/"
  // open and dump the url
  $fp=fopen
("http://protected_userid:$protected_passwd@$protected_url","r");
  @header("Content-Type: text/html");
  fpassthru($fp);
  exit;
?>
You may also use CURL, for more information on how to use CURL, visit:
    http://www.php.net/manual/en/ref.curl.php