I am trying to get response from the following URL using cUrl
and file_get_content()
of PHP-
https://www.bkashcluster.com:9081/dreamwave/merchant/trxcheck/sendmsg?user=<USERNAME>&pass=<PASSWORD>&msisdn=<MSISDN>&trxid=<TRANSACTION_ID>
For simplicity-
https://www.bkashcluster.com:9081/dreamwave/merchant/trxcheck/sendmsg
For valid request it responses XML with the details information of a transaction, but for the second url or for any request with incorrect parameter it responses something as follows from browser or postman-
<transactions>
<transaction>
<trxStatus>1002</trxStatus>
<trxId>6E72D8VS02</trxId>
<reference/>
</transaction>
</transactions>
I've written a php code to get this response like this-
$endPoint = "https://www.bkashcluster.com:9081/dreamwave/merchant/trxcheck/sendmsg?user=xxxx&pass=xxxx&msisdn=xxxx&trxid=xxxx";
$xmlString = file_get_contents($endPoint, FILE_TEXT);
Also tried using cURL as-
$curl = curl_init($endPoint);
curl_setopt($curl, CURLOPT_PORT, 9081); // Tried with or without
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$xml_string = curl_exec($curl);
Problem: In both cases I get response perfectly from localhost but when I execute it from web server connection gets refused.
Error shows something like this-
file_get_contents()
failed to open stream: Connection refused
curl_error()
couldn't connect to host
To be mentioned, both functions are working in the server for any other url like https://google.com
I found this almost similar question in stackoverflow but unfortunately it doesn't have any answer.
Is there any restriction from host site? Or I'm missing something or need any extra thing to do? Or it's not working for different port rather than 80?