PHP: FTP problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi experts and professionals.

My goal is to automatically download PDF files and convert them to
HTML using pdftohtml library.

Here is how it works:
1. It downloads PDF file using file_get_contents()
2. Uses pdftohtml library and perform conversion

My problem is when I'm trying to fetch PDF files from symantec FTP

file_get_contents() fails with RETR response 425 (can't open

I tried curl library, and I get the same error. Here is my code:

$pdf = " /

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $pdf);
curl_setopt($ch, CURLOPT_HEADER, 0);

$str = curl_exec($ch);
if ($str === false)
    echo "Can't get PDF file: <br/>" . curl_errno($ch) . ': ' .


This code produces this output:

Can't get PDF file:
19: RETR response: 425

If you put this url to Mozilla browser, it successfully loads PDF
file. So I guess that I need to specify specific options to connect to
the FTP using curl.

I'm open to use any solution (not curl only). Just help me to
understand how to solve my problem.


Re: PHP: FTP problem

Quoted text here. Click to load it

Is this a Mozilla browser running on the same machine where you are
trying to run your PHP code - otherwise the comment is meaningless -
try from the PHP server.

RTFM on file wrappers and safe_mode - or just see if you can open an
HTTP file using file_get_contents.

Use passive mode with curl.

If still broken - post again with the results for the above.


Re: PHP: FTP problem

I just found that CURL uses passive by default

Site Timeline