I'm trying to upload a txt file (2KB in size) using PHP cURL to Sharefile via implicit FTPS, however I'm receiving:
Connection timed out after 30000 milliseconds
Closing connection 0
My code is below, any advice is appreciated:
$fp = fopen($local_file, 'rw+');
$ftp_url = 'ftps://subdomain.sharefileftp.com/'.$ftp_path;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ftp_url);
curl_setopt($ch, CURLOPT_PORT, 990);
curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password);
curl_setopt($ch, CURLOPT_FTP_SSL, CURLFTPSSL_TRY);
curl_setopt($ch, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_TLS);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);
The output array from curl_getinfo is mostly empty values with the url set.
curl_setopt($ch, CURLOPT_STDERR, fopen('curl.txt', 'w+')); outputs the following (shortened for this post):
* Expire in 0 ms for 1 (transfer 0x56523a8e1070)
* Expire in 1 ms for 1 (transfer 0x56523a8e1070)
* TCP_NODELAY set
* Trying X.X.X.X...
* Expire in 200 ms for 4 (transfer 0x56523a8e1070)
* Connection timed out after 30002 milliseconds
* Closing connection 0
You may want to try adding
CURLOPT_TRANSFERTEXT,trueI'd try something like this:
When I get in trouble I add these options
Usually your request header will give you some clues.