Reply to Re: Automate access to password protected sites

Your name:

Reply:


Posted by d on 01/25/06 13:51

"Darren" <groups@darrenludlam.plus.com> wrote in message
news:1138122708.477954.222130@g47g2000cwa.googlegroups.com...
> Hello,
>
> we're fully paid up and signed up to a password protected site, so this
> isn't hacking. In this site we can download a price list in CSV
> format.
>
> What I'd like to do is have a PHP script log into the site and download
> the CSV file so we can then display it on our website.
>
> Is this posible?

It's very possible. As other posts have said - make sure it's not against
the site's rules to do this. Just because you can manually view the list
doesn't mean to say you can do it automatically.

The best way to do it is to use cURL. I say that because unless you feel
particularly comfortable with writing and interpreting HTTP requests
(they're not hard, but you do need to do some reading), cURL will do most of
the work for you. I would do it like this:

Step 1. Read the page where you would log in, using cURL. Get the HTML and
find the form. Get the variable names from the form (for username and
password) - this is done in case they change the variable names, your script
will still work.

Step 2. Create your post variables containing the variable names from step
1 and your own username and password. Submit these variables to the action
of the form you read in step 1.

Step 3. Now, cURL should be remembering your session ID/cookie (you might
have to set the cookie jar/file settings for cURL - this is covered
adequately on the PHP site, http://www.php.net/curl).

Step 4. Using cURL, access the CSV's url - cURL should tell the server what
it needs to hear to accept that you're logged on, and the file should be
available.

I hope that helps.

dave

> Darren
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация