php-curl doesn't connect to remote host and header appear to be empty -


i configured 1 of server accept files via post, convert them , send them response. php server uses functionality via curl.

the important part in php script looks this

$ch = curl_init();  curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_port, $port); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_postfields, array('file_contents' => '@' . $filename)); curl_setopt($ch, curlopt_connecttimeout, 5); curl_setopt($ch, curlinfo_header_out, true);  file_put_contents($filename . '.png', curl_exec($ch));  print_r(curl_getinfo($ch)); echo curl_errno($ch);  curl_close($ch); 

however appears if curl doesn't connect other server , curl_getinfo returns

array (     [url] => (redacted)     [content_type] =>      [http_code] => 0     [header_size] => 0     [request_size] => 0     [filetime] => -1     [ssl_verify_result] => 0     [redirect_count] => 0     [total_time] => 0     [namelookup_time] => 0.036982     [connect_time] => 0     [pretransfer_time] => 0     [size_upload] => 0     [size_download] => 0     [speed_download] => 0     [speed_upload] => 0     [download_content_length] => -1     [upload_content_length] => -1     [starttransfer_time] => 0     [redirect_time] => 0     [redirect_url] =>      [primary_ip] => (redacted)     [certinfo] => array         (         ) ) 

curl_errno returns 28 (curle_operation_timedout) if increase timeout. said before seems doesn't establish connection remote host. it's possible connect given url using web browser.


Comments

Popular posts from this blog

Upgrade php version of xampp not success -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -