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

curl-and-php

CURLOPT_RESUME_FROM issues

From: Gavin O' Gorman <gavin.ogorman_at_gmail.com>
Date: Sat, 13 Oct 2007 23:22:38 +0100

Hello,

I have been unsuccessfully trying to use the resume option with curl.
My PHP code is:

public function downloadFile($url, $filename, $resumeFrom=0) {
  $fp = fopen($filename, "a");
  curl_setopt($this->ch, CURLOPT_URL, $url);
  curl_setopt($this->ch, CURLOPT_FILE, $fp);
  curl_setopt($this->ch, CURLOPT_HEADER, 0);
  curl_setopt($this->ch, CURLOPT_PORT, 80)
  curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
  if($resumeFrom) {
    curl_setopt($this->ch, CURLOPT_RESUME_FROM, $resumeFrom);
  }
  $ret = curl_exec($this->ch);
  if($ret)
    return curl_getinfo($this->ch);
  }
}

I am running PHP Version 5.2.1 with
libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5
on Ubuntu 7.04

Without the CURLOPT_RESUME_FROM being set, files download
correctly.When it is set, I get a false value returned from
curl_exec(). I ran wireshark to see what was happening and a HTTP
session is not even established. A TCP SYN, SYN-ACK, ACK converstion
occurs, but is immediately terminated by the local machine with a FIN.

I have tested file resumption from my test server using the curl
command line tool, with curl -C 512 -O http://url

It works fine, as does wget.

Does anyone have any ideas ? Can anyone confirm that it works for them ?
Thanks,
Gavin
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-10-14