Hello everybody. My question is does anybody know any script commands that will allow me retrieve information from an website that has a user name and password? For example, I write a script that ask the user to enter in a user name and password, then the script goes to the website to query some information and the user doesn't need to go to the website himself to enter in the user name and password.

Recommended Answers

All 6 Replies

Well if that website that php re-enters the password in uses $_GET tags and not $_POST tags then you can simply use the file_get_contents() function to retieve the information. If however the external website uses $_POST tags then you will need to use curl.
So the basic usage of file_get_contents for communicating with an external website is as follows:

<?
$page=file_get_contents('http://www.example.com/page?user=cwarn23&pass=820578wxz56240358');
?>

Btw, that's a fake password. Hope the above example helps.

Look into curl, as it will let you do just what you want with any types of authentications, i.e. Get, Post or the .htaccess one

Thanks guys, one more question, does anybody know the Visual Basic Script version of what he typed up above?

Thanks guys, one more question, does anybody know the Visual Basic Script version of what he typed up above?

Who typed what above? If your refering the the script I posted earlier that is a php script which just retrieves the file/url contents.

Who typed what above? If your refering the the script I posted earlier that is a php script which just retrieves the file/url contents.

Yes, I was just wanting to know if you knew how to convert the php script you just wrote into visual basic script?

Would the example here be of any use to you?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.