echo file_get_contents("http://
Main Topics
Browse All TopicsHi
I would like to access a webpage that has http authorisation on it and read it's contents into a variable. I thought I could just pass the username and password in as part of the url, eg http://username:password@d
Is there a way of doing this in PHP?
Once I get to the page, I would like to compare the html with a value in the database and if it has changed, update it.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
echo file_get_contents("http://
I need the same thing.. I have a username and a password of a computer distributor and I need to update all his product in my database (+10.000 items)...
$url = "http://www.google.com";
$lines = file($url);
foreach ($lines as $line_num => $line) {
echo "$line\n";
}
This works perfect on google.com as example but not for a website that require a password (session based)
Thanks
$data = exec('curl --user user:password http://example.com/');
try that.
http://us2.php.net/curl is capable of doing what you want, reason using shortcut through commandline like above.
hmm I cant find it..
The problem, in my case, is: When I go to the page that I need -> that page redirects to http://ssl.ingrammicro.com
HTTP/1.1 502 Bad Gateway Connection: close Content-type: text/html Content-length: 441 Pragma: no-cache Cache-control: no-cache Error. We're sorry! An error has occurred: Problem connecting to destination (Encountered while fetching http://ssl.ingrammicro.com
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept - Cryptic_Mauler
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
- Neester -
EE Cleanup Volunteer
Business Accounts
Answer for Membership
by: CrYpTiC_MauleRPosted on 2005-09-05 at 15:53:24ID: 14825780
could you post the code you are using?