Http Authentication using PHP

There are two easy ways to login to a page protected by htaccess using PHP. You need to have the username and password of course… Anyway, a good use for this is if you want to scrape a page behind an htaccess login, or if you need to do something progammatically behind htaccess password protection.

1) You can access the page as:
http://username:password@domain.com/folder/page.php

2) You can set an extra parameter in curl:

curl_setopt($ch, CURLOPT_USERPWD, “username:password”);

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank

Home | PHP | Http Authentication using PHP