PHP FTP problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
delsuono
Forum Newbie
Posts: 1
Joined: Sun Sep 28, 2008 3:25 am

PHP FTP problem

Post by delsuono »

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
server:
ftp://exftpp.symantec.com/pub/support/p ... terprise_S...

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

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

*****
$pdf = "ftp://exftpp.symantec.com/pub/support/products/
NetBackup_Enterprise_Server/279289.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) . ': ' .
curl_error($ch);
else
var_dump($str);

curl_close($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.

Thanks,
Anton
Post Reply