Grabing a file from a remote source (auth required)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
avataru
Forum Newbie
Posts: 2
Joined: Tue May 08, 2007 4:21 am

Grabing a file from a remote source (auth required)

Post by avataru »

Hello everyone,

I'm trying to create an iGoogle gadget which will grab an XML file and output something besed on its contents. The problem I'm having is that in order to get the XML file, authentication is required.

The url is something like this:
https://www.website.com/login.php?user= ... ?id=123456

When you go to that url with a browser the server will authenticate you and redirect you to https://www.website.com/xmlgenerator.php?id=123456 which outputs the XML file I need.

Any idea if it's possible to do this using PHP?

Thank you in advance.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Use cURL to log in and to grab the necessary XML File....Search here there are some good examples :)
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

CURL could potentially be used.

Do you have an agreement with the site's ownsers to allow you to pull down the information ?
avataru
Forum Newbie
Posts: 2
Joined: Tue May 08, 2007 4:21 am

Post by avataru »

Yes, I am allowed to grab the file.

Just after I finished posting I found out about cURL / libcurl but they both require me to install it on the server, and I can't do that. Is there any pure-php solution?
Post Reply