Forum Moderators: open

Message Too Old, No Replies

Need to get data sent by BASIC AUTHENT. protected page

ajax data

         

roel018

2:54 pm on Jul 15, 2009 (gmt 0)

10+ Year Member



Hi all!

I have a page (.php page) that provides me with live data from a database.. However, this page is HTTP/POST AUTHENTICATED (basic) .. So, normally, if I would enter the name of this PHP file directly into the browser's address field, I would get a USERNAME/PASSWORD dialog box, and only after I enter the correct values, I get the data I want..

I would really really like to have a javascript AJAX request method that implements this username/password authenticaton in a SAFE way, so I don't need to enter the USERNAME/PASSWORD but it instantly returns the parsed value sent by the .php page.

Is this possible? How can I possibly do it?

THANKS! Any help is really appreciated!

Kind regards,
Roel

whoisgregg

10:00 pm on Aug 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello roel018,

I would recommend making a PHP proxy page that sends the authentication details. Basically you can have the PHP script call the protected URL with this format:

http://username:password@example.com/path/to/script.php

In the PHP script you could either use cURL or just file_get_contents() depending on how your server is configured.

HTH :)