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
1,567 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
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
jk2001 earned 125 total points
Comment Utility
Study up on the cURL libraries.  They support posting forms and sending cookies.
0
 
LVL 11

Assisted Solution

by:ch2
ch2 earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now