curl-and-php
Re: problems downloading files with differents ports
Date: Wed, 28 Jan 2009 08:22:03 -0800
You testing for existence of output file.
Try curl_setopt ($ch, CURLOPT_PORT , 8003);
Look at the headers from the curl request and see what it is giving you
back.
Jordi Agusti Fonoll wrote:
>
> Hi people,
>
> I’m using PHP + curl to download from different hosts, it’s working
> correctly but I have problems with some URL’s. I have this general
> function:
>
> function get_file1($file, $local_path, $newfilename)
>
> {
>
> $err_msg = '';
>
> echo "<br>Attempting message download for $file<br>";
>
> $out = fopen($local_path.$newfilename, 'wb');
>
> if ($out == FALSE){
>
> print "File not opened<br>";
>
> exit;
>
> }
>
> $ch = curl_init();
>
> curl_setopt($ch, CURLOPT_FILE, $out);
>
> curl_setopt($ch, CURLOPT_HEADER, 0);
>
> curl_setopt($ch, CURLOPT_VERBOSE, true);
>
> curl_setopt($ch, CURLOPT_URL, $file);
>
> //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>
> curl_exec($ch);
>
> echo "<br>Error is : ".curl_error ( $ch);
>
> curl_close($ch);
>
> fclose($handle);
>
> }
>
> When I try to download this file:
> http://213.97.223.180:8003/AUDIO_A_LA_CARTA/28-01-2009_09-00-02_DIRECTO_MARCA_CON_JUAN_MANUEL_GOZALO.MP3
> it give me error and culr say to me:
>
> About to connect() to 213.97.223.180 port 8003
>
> * Trying 213.97.223.180... * Connection refused
>
> * couldn't connect to host
>
> * Closing connection #0
>
> <br>Error is : couldn't connect to host
>
> You can see that the file exist and I don’t understand why I can’t get
> it (maybe the problem is in the port). Anyone have an idea???
>
> Jordi.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
- text/x-vcard attachment: platypus.vcf