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

curl-and-php

Newbie question concerning ftplistonly option

From: Frederic Fleche <frederic.fleche_at_gmail.com>
Date: Tue, 6 Sep 2005 15:04:36 +0200

Hello curl guys,

When I execute the following code lines I get an html code that list a ftp
directory.
Since I would like to get the list without the html code I inserted the the
following line witout any effect :
curl_setopt ($ch, CURLOPT_FTPLISTONLY, 1);
Could you please let me know what I missed ti append, change or delete in my
code.

I did some google groups search without any success so your a my last
chance,

Thanks in advance,

Fred

<?php
$proxyname = "firewall";
$proxyport = "81";
$username = "s8";
$userpassword = "cd";

if(! $output_file = fopen("./list_ftp_address.txt", "w")) die("problem to
create the file");;

$url = "ftp://ftp.sanger.ac.uk/pub/CGP/cosmic/data_export/";
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FTPLISTONLY, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
curl_setopt ($ch, CURLOPT_PROXY, "$proxyname:$proxyport");
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "$username:$userpassword");

$essai = curl_exec($ch);

fwrite($output_file, $essai);
fclose($output_file)
?>
Received on 2005-09-06