Zoho writer remote api very slow through php/curl?

Zoho writer remote api very slow through php/curl?

Hi!

I'm trying to use cURL to post a .doc-file to Zoho Writer instead of using the form from the example. When posting using the example form code and the url-field, the word file is read within a few seconds. When I use the following code to emulate a file upload, it takes a few minutes(!).

<?php

define("ZOHO_API_KEY", "**");
$langcode = "sv";

$url = 'http://export.writer.zoho.com/remotedoc.im?apikey='.ZOHO_API_KEY.'&output=url'.'&lang='.$langcode;

$fields = array('id' => time(),
          'filename' => "test.doc",
         'persistence' => 'false',
         'format' => "doc",
         'saveurl' => "http://domain.com/save.php",
         'content' => "@/path/to/zoho/test.doc"
         );

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);


$result = trim($result);

$matchlines = explode("\n", $result);

$url = explode("URL=", $matchlines[0]);

header("Location: ".$url[1]);


























?>

What makes the curl process so slow?