Closed

Write a cURL script to automatically transfer file to FTP site each night

This project received 4 bids from talented freelancers with an average bid price of $336 USD.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
$30 - $250 USD
Total Bids
4
Project Description

We have a need to automatically upload a file to an FTP site on a nightly or weekly basis. The file needs to be uploaded through a cURL script. Here are the instructions provided to us.

To upload subscription data from a file using a command-line interface, follow this general procedure:

1. Set up a license in the Admin Tool for your Person identity to access the directSubscriptionUpload

content slice (Section 5.1 - see below).

2. Create the upload file in the specified format (Section 5.2 - see below).

3. Create a cURL cookies file (Section 5.3 - see below).

4. Upload the file using an upload utility that can send HTTPS POST messages, such as cURL

(Section 5.4 - see below).

5. Check the status of the file upload and processing (Section 5.5 - see below).

Before you begin, set up an HTTPS POST utility (such as cURL). To download a version of cURL

appropriate for your operating system (use the non-SSL version), refer to:

[url removed, login to view]

Note: Our Operating System is Windows Server 2003.

5.1. Set Up a License

This procedure only needs to be done once.

1. Create a Person identity.

If needed, create a Person identity, including username and password, for the user performing the

direct subscription upload.

2. Create a Service content slice.

a. In the Admin Tool, click the Content Slices sidebar button and select Service from the Content

Type drop-down.

b. Enter directSubscriptionUpload in the Service Name field and click Search.

c. If no results are found, click OK, enter a description of the service in the Description field, and

click Create.

3. Create a license.

a. In the Admin Tool, click the Licenses sidebar button and click into the Create One-off Licenses

panel.

b. Create a license using the directSubscriptionUpload content slice and the Person identity

created above (refer to the Licenses User Guide).

5.2. Create the Subscription Upload File

Create a subscription upload file in the custom format required for your platform (Section 2.7).

5.3. Create a Cookies File

Create a cookies file with cURL login information. For example:

curl -c [url removed, login to view] -b I2KBRCK=1 -d login={username} -d password={password} https://

{host}/action/doLogin

where {username} and {password} are the attributes of the Person identity, and {host} is the Literatum

website. This command stores the session cookies in cookies.txt.

This only needs to be done once per session.

5.4. Upload the Subscription File

Next, use a web form or a command-line HTTPS utility such s cURL to make a POST call to the upload

URL.

Assuming you have created a cookies file named [url removed, login to view], upload the subscription file using the

following command:

curl -b [url removed, login to view] -F file1=@C:\{uploadFile}.txt -F format={subscriptionFileFormat} -F

email={myEmailAddress} https://{host}/action/directSubscriptionUpload

where you replace:

• {uploadFile}.txt with the name of the upload file. Include the @ (at) symbol and the directory path

of the file.

• {subscriptionFileFormat} with the subscription file format name as found in the Admin Tool (in

the File Format drop-down menu). If the format name contains spaces, enclose the name in double

quotes (e.g., "Eclipse Institutional Subscriptions").

• {myEmailAddress} with the email address to which notification of the status of the subscription

upload should be sent.

• {host} with the URL of your website.

For example:

curl -b [url removed, login to view] -F file1=@C:\Users\BJohnson\[url removed, login to view] -F format="Eclipse

Institutional Subscriptions" -F email= [url removed, login to view]

action/directSubscriptionUpload

5.5. Direct Subscription Upload Status

If an error occurs while posting to the direct subscription upload service, an email is sent to all email

addresses specified in the command. Any errors that occurred during processing of the subscription file

can be viewed in the Admin Tool (see Chapter 4).

The direct subscription upload service returns 200 OK if the POST is successful and 500 if an error

occurred.

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online