Hi everyone I am struggling with calling BEX api from php code.
Magento 2 is used but calling api from local machine I get appropriate and expected response and I get the same when executing curl on remote server.
Response that I get calling api from php code is:
VERBOSE OUTPUT: * Trying 213.133.127.76:62502...
* connect to 213.133.127.76 port 62502 failed: Connection refused
* Failed to connect to api.bex.rs port 62502: Connection refused
* Closing connection 0
curl function that work from local but not remote are:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'api.bex.rs:62502/ship/api/Ship/postShipments',
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 =>'{...}',
CURLOPT_HTTPHEADER => array(
'X-Auth-Token: TOKEN',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Whatever I do the response is same. Problem is that I have very limited access to remote server and I barely can change anything.
Please assist if you can, anything would be helpful.
2