Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-11-28
6
Medium Priority
?
1,574 Views
Last Modified: 2012-06-22
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
0
Comment
Question by:LhXs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
John Kawakami earned 500 total points
ID: 18033441
Study up on the cURL libraries.  They support posting forms and sending cookies.
0
 
LVL 11

Assisted Solution

by:ch2
ch2 earned 500 total points
ID: 18034088
You can use a HTTP class that will do the job for you.

This will do all 4 steps.

http://code.blitzaffe.com/pages/phpclasses/files/http_retriever_52-6
0
 

Author Comment

by:LhXs
ID: 18037149
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
0
 
LVL 11

Expert Comment

by:ch2
ID: 18037321
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question