Announcement

Collapse
No announcement yet.

Espo API curl timeout ERROR

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Espo API curl timeout ERROR

    Hi,
    I need to send API POST request to Espocrm from espo custom service code, which triggered by workflow.

    CURL error response cURL error 28: Connection timed out;

    Code:
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => 'http://$myserverip/api/v1/SalesOrder',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>$NewSalesOrder,
    CURLOPT_HTTPHEADER => array(
    'Authorization: Basic ***********',
    'Content-Type: application/json'
    ),
    ));
    
    $response = curl_exec($curl);
    $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    $error = curl_errno($curl);
    curl_close($curl);
    When I'm run service code from my local machine, this curl normaly run without any error and create entity as I need.

    Where is the problem? Can you help me please.

    PS: I know how to create it with Entity manager, but it's not compatible with my another hook.
    Last edited by smartinsar; 03-25-2022, 10:10 AM.
Working...
X