0

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?

Partharaj Deb
  • 864
  • 1
  • 8
  • 22
  • you have to try all listed solution from this question. I am sure one of them will work for-sure:- [How to resolve cURL Error (7): couldn't connect to host?](https://stackoverflow.com/questions/9922562/how-to-resolve-curl-error-7-couldnt-connect-to-host) – Alive to die - Anant Jun 18 '19 at 04:35
  • 2
    Host's IP could be being blocked –  Jun 18 '19 at 04:41
  • cant actually connect to that URL from home or work servers at all –  Jun 18 '19 at 04:59
  • @AlivetoDie I've tested all possible solutions but unfortunately not worked, – Partharaj Deb Jun 18 '19 at 06:21
  • @tim I've tested from two different server, and URL works from google insights too, please visit- https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.bkashcluster.com%3A9081%2Fdreamwave%2Fmerchant%2Ftrxcheck%2Fsendmsg&tab=mobile – Partharaj Deb Jun 18 '19 at 06:23

1 Answers1

0

it's almost certainly an IP block (or range block or region block?), you could try tracerouting it, it may reveal where you're being blocked, but have you tried from another IP? for the record, i have tried connecting from Norway, France, Canada, and the Netherlands, i can connect from all of those locations, sooo.. an ip/range block, most likely.

hanshenrik
  • 19,904
  • 4
  • 43
  • 89
  • I tested from several hosting servers of different IP range. Which I observed, it's not working from any Shared Hosting servers, but worked from 3 VPS, though I don't know the actual reason. – Partharaj Deb Jun 19 '19 at 15:07
  • @PartharajDeb let me guess, all the `Shared Hosting servers` you tested from are all companies whose parent company is `Endurance International Group` ? (they own a shitton of hosting services, HostGator, BlueHost, domain.com, among many others) – hanshenrik Jun 19 '19 at 15:13