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

curl-and-php

FTP problem

From: Anton Andrievskij <x.meglio_at_gmail.com>
Date: Sun, 28 Sep 2008 14:18:11 +0300

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/products/NetBackup_Enterprise_Server/279289.pdf

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). But I hope this can be solved
using curl.

Just help me to understand how to solve my problem.
Many thanks in advance,
Anton

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-09-28