cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Deleting a file using curl and php

From: Adam Richardson <adam_at_envisionic.com>
Date: Sun, 31 Aug 2008 01:52:26 -0400

Hi, I've searched on google and didn't see anything on how to do this.

I'm aware of code like the following that allows me to update or save a file
to a server using ftp within curl:

<?php
//
// A simple PHP/CURL FTP upload to a remote site
//

$ch = curl_init();
$localfile = "me-and-my-dog.jpg"

$fp = fopen ($localfile, "r");

// we upload a JPEG image
curl_setopt($ch, CURLOPT_URL,
            "ftp://mynamw:mypassword@ftp.mysite.com/path/to/destination.jpg");
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);

// set size of the image, which isn't _mandatory_ but helps libcurl to do
// extra error checking on the upload.
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));

$error = curl_exec ($ch);

// check $error here to see if it did fine or not!

curl_close ($ch);
?>

How do I alter this code to delete a file on a remote server?

Thank you for your help,

Adam

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-08-31