Link to home
Start Free TrialLog in
Avatar of LhXs
LhXs

asked on

How to login to a remote site (username and password), spoof a cookie and download a file (locally to the server)!!

OK, apologies if this seems a lot of work, but it's really not such a big task.

I am hoping for some advice about mecanisms (bonus for some code to do it as well) to do the following things with a PHP script:
1)Call a URL
2)That URL requires a login, so I need to pass a username and password to the input boxes
3)Once logged into that site, I can call a second url (which is the equivalent of clicking a "download" button)
4)Receive the file back to the webserver (a simple CSV file) and store it in the desired location

I cannot confirm whether the site requires cookies or not.  If you know anything about cookie spoofing from a server, advice or resources would be appreciated.

This job will then be run on a Cron Job.

Many thanks for your time on this one experts.  EE has never ceased to amaze me, I'm sure it won't let me down this time!

Matt
ASKER CERTIFIED SOLUTION
Avatar of John Kawakami
John Kawakami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LhXs
LhXs

ASKER

Many thanks,
That does look like the sort of script I'm after but it doesnt provide much support or explanation on how to use it.  Anyone got any advice for it or useable scripts?

Thnaks for you help

Matt
Inside the zip there is an example, but if you want more support use the method jk2001 cURL give you because it's a php library and is well documented.

Mike