Frederic Fleche | 6 Sep 2005 15:04
Picon

Newbie question concerning ftplistonly option

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)
?>

Daniel Stenberg | 6 Sep 2005 15:29
Picon
Favicon

Re: Newbie question concerning ftplistonly option

On Tue, 6 Sep 2005, Frederic Fleche wrote:

> When I execute the following code lines I get an html code that list a ftp 
> directory.

When you use a (HTTP) proxy with a FTP URL, the protocol spoken is effectively 
HTTP and not FTP. Thus the FTP-specific curl options no longer have any 
effect.

--

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html

lobos@webvida.com | 10 Sep 2005 05:56

converting fopen and fread funtion to work as with CURL

Hi there,

Just switched to Dreamhost and have found that they don't allow fopen 
and fread... I have this little function and I was wondering if anyone 
could tell me if this could work with CURL and if so give me a few 
pointers on how to go about converting the function....

Function FetchAndGet($url) {
            $tmon = fopen($url, "rb");
            while (!feof($tmon)) {
             $readfile = $readfile . fread($tmon, 1024);
            }
            fclose($tmon);
            return $readfile;
        }

Thanks!

Adam Docherty

Daniel Stenberg wrote:

> On Tue, 6 Sep 2005, Frederic Fleche wrote:
>
>> When I execute the following code lines I get an html code that list 
>> a ftp directory.
>
>
> When you use a (HTTP) proxy with a FTP URL, the protocol spoken is 
> effectively HTTP and not FTP. Thus the FTP-specific curl options no 
> longer have any effect.
>

lobos@webvida.com | 10 Sep 2005 06:37

Re: converting fopen and fread funtion to work as with CURL

Ah it was not so hard after all!

function FetchAndGet($url) {

        $c = curl_init($url);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        $page = curl_exec($c);
        curl_close($c);

        return $page;
 }

Actually I think cURL works faster than fopen :)

lobos <at> webvida.com wrote:

> Hi there,
>
> Just switched to Dreamhost and have found that they don't allow fopen 
> and fread... I have this little function and I was wondering if anyone 
> could tell me if this could work with CURL and if so give me a few 
> pointers on how to go about converting the function....
>
> Function FetchAndGet($url) {
>            $tmon = fopen($url, "rb");
>            while (!feof($tmon)) {
>             $readfile = $readfile . fread($tmon, 1024);
>            }
>            fclose($tmon);
>            return $readfile;
>        }
>
> Thanks!
>
> Adam Docherty
>
> Daniel Stenberg wrote:
>
>> On Tue, 6 Sep 2005, Frederic Fleche wrote:
>>
>>> When I execute the following code lines I get an html code that list 
>>> a ftp directory.
>>
>>
>>
>> When you use a (HTTP) proxy with a FTP URL, the protocol spoken is 
>> effectively HTTP and not FTP. Thus the FTP-specific curl options no 
>> longer have any effect.
>>
>
>
>
> __________ NOD32 1.1213 (20050909) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>

rhn | 12 Sep 2005 13:55
Picon
Favicon

redirect address

How to get the URL that CURL is redirected to with CURLOPT_FOLLOWLOCATION?
Is it stored somewhere in the header? My app behaves improperly unless no redirects are used - I have some
more complicated URL issues.

Baragan Andrei | 28 Sep 2005 14:38
Picon
Favicon

Re: Simultaneous curl posts on the same URL [without curl_multi]

Thanks a lot but i solved it, my code was perfectly fine, i only needed to perform a right trim to my post variables, that was the only problem.

As for $$:

 $var_hi = "Hi";

 $$var_hi = "curlers";

 print "$Hi"; //should print "curlers"  

Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Naveed Memon | 29 Sep 2005 03:08
Picon

Curl Unable to Connect to Apache Server

I am having trouble connecting to a website running on Apache server, if I type in the address on my browser, it works perfectly fine, but when I try to grab it with CURL I get this error: here I’m trying to grab a folder/filename.php  even if I just try to get the top level index file, I get this error… Can’t find any online help for that!


Not Acceptable

An appropriate representation of the requested resource /foldername/filename.php could not be found on this server.

Apache/1.3.xx Server at www.example.comPort 80

 

 

I’m using CURL 7.11.2 with PHP… I’ve used curl with many websites, but I have never seen this problem before… Any help would be appreciated!!

 

 

Thanks

- Naveed

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Yuplounge - Info | 29 Sep 2005 08:45

RE: Curl Unable to Connect to Apache Server

Hi Naveed,

Send Your code. I don’t have a cristal boll. Or give the site address, so we can try it our selve.

 

W-P

 

 

Van: curl-and-php-bounces <at> cool.haxx.se [mailto:curl-and-php-bounces <at> cool.haxx.se] Namens Naveed Memon
Verzon
den: donderdag 29 september 2005 3:08
Aan: curl-and-php <at> cool.haxx.se
Onderwerp: Curl Unable to Connect to Apache Server

 

I am having trouble connecting to a website running on Apache server, if I type in the address on my browser, it works perfectly fine, but when I try to grab it with CURL I get this error: here I’m trying to grab a folder/filename.php  even if I just try to get the top level index file, I get this error… Can’t find any online help for that!


Not Acceptable

An appropriate representation of the requested resource /foldername/filename.php could not be found on this server.

Apache/1.3.xx Server at www.example.comPort 80

 

 

I’m using CURL 7.11.2 with PHP… I’ve used curl with many websites, but I have never seen this problem before… Any help would be appreciated!!

 

 

Thanks

- Naveed

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Gmane