cURL & DNS Troubleshooting
Most servers can connect to the GG Pay API normally. However, some shared hosting servers may have a local DNS/NSS resolver problem. In that situation, the domain may work from your computer but fail when requested from your hosting server.
Recommended Testing Order - Test normal cURL first.
- Check DNS resolution.
- If DNS is incorrect or unavailable, test using
--resolve. - If
--resolve works, ask your hosting provider to fix server-side DNS/NSS. - For PHP cURL, use
CURLOPT_RESOLVE as a temporary workaround.
1. Test Normal cURL
SSH / Terminal
curl -I "https://payment.zhrteam.xyz/"
You can also test the API endpoint:
curl -i -X POST "https://payment.zhrteam.xyz/api/payment/create" \-H "Content-Type: application/json" \-H "Accept: application/json" \-H "API-KEY: YOUR_API_KEY" \-d '{ "cus_name": "John Doe", "cus_email": "[email protected]", "amount": "100", "success_url": "https://yourdomain.com/payment/success", "cancel_url": "https://yourdomain.com/payment/cancel", "meta_data": { "order_id": "ORD-1001" }}'
2. Check DNS Resolution
Run one or more of the following commands:
getent hosts autopay.ggtopup.shop
nslookup autopay.ggtopup.shop
If these commands return the wrong address, no address, or an unexpected internal/server address, the hosting server may have a DNS resolver/NSS configuration issue.
3. Test With cURL --resolve
If normal cURL fails because the server resolves the hostname incorrectly, you can temporarily force cURL to connect to a specific IP while still sending the correct HTTPS hostname.
Temporary DNS Override
curl --resolve autopay.ggtopup.shop:443:172.67.187.37 \-I "https://payment.zhrteam.xyz/"
For the Create Payment API:
curl --resolve autopay.ggtopup.shop:443:172.67.187.37 \-X POST "https://payment.zhrteam.xyz/api/payment/create" \-H "Content-Type: application/json" \-H "Accept: application/json" \-H "API-KEY: YOUR_API_KEY" \-d '{ "cus_name": "John Doe", "cus_email": "[email protected]", "amount": "100", "success_url": "https://yourdomain.com/payment/success", "cancel_url": "https://yourdomain.com/payment/cancel", "meta_data": { "order_id": "ORD-1001" }}'
Important About --resolve --resolve is a cURL testing/workaround feature. It does not permanently repair the hosting server's DNS configuration.
4. Why Does --resolve Work?
When cURL normally requests: autopay.ggtopup.shop the operating system first needs to resolve the hostname to an IP address.
If the hosting server's DNS resolver returns an incorrect address or fails to resolve the domain, the connection may fail.
With --resolve cURL is instructed to use the specified IP for that hostname and port.
Best Long-Term Solution If --resolve works but normal cURL does not, contact your hosting provider and ask them to check the server's DNS/NSS resolver configuration. After the provider fixes DNS, remove the temporary override.
5. PHP cURL CURLOPT_RESOLVE
PHP applications can use the same temporary technique through libcurl's CURLOPT_RESOLVE option.
<?php$apiUrl = 'https://payment.zhrteam.xyz/api/payment/create';$payload = [ 'cus_name' => 'John Doe', 'cus_email' => '[email protected]', 'amount' => '100', 'success_url' => 'https://yourdomain.com/payment/success', 'cancel_url' => 'https://yourdomain.com/payment/cancel', 'meta_data' => [ 'order_id' => 'ORD-1001', ],];$ch = curl_init($apiUrl);curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Accept: application/json', 'API-KEY: YOUR_API_KEY', ], CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, CURLOPT_RESOLVE => [ 'autopay.ggtopup.shop:443:172.67.187.37', ], CURLOPT_CONNECTTIMEOUT => 15, CURLOPT_TIMEOUT => 60,]);$response = curl_exec($ch);if ($response === false) { throw new Exception( 'cURL Error: ' . curl_error($ch) );}$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);curl_close($ch);$data = json_decode($response, true);if (!is_array($data)) { throw new Exception( 'Invalid JSON response from GG Pay.' );}if ( $httpCode >= 200 && $httpCode < 300 && isset($data['status']) && (int) $data['status'] === 1 && !empty($data['payment_url'])) { header( 'Location: ' . $data['payment_url'] ); exit;}throw new Exception( $data['message'] ?? 'Unable to create payment.');
Temporary Workaround Only Do not permanently hard-code a Cloudflare edge IP unless you fully control and understand the networking configuration. Cloudflare addresses and routing can change.
6. PHP Without CURLOPT_RESOLVE
If normal DNS works correctly on your server, you do not need CURLOPT_RESOLVE . Use normal PHP cURL:
curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Accept: application/json', 'API-KEY: YOUR_API_KEY', ], CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_CONNECTTIMEOUT => 15, CURLOPT_TIMEOUT => 60,]);
7. Common cURL Errors
| Error | Meaning | Recommended Action |
| Could not resolve host | Server cannot resolve the API hostname. | Check DNS and test --resolve . |
| cURL error 6 | Hostname could not be resolved. | Check server DNS/NSS configuration. |
| Connection timed out | Server could not establish the connection within the timeout. | Test connectivity, firewall and DNS resolution. |
| SSL certificate problem | TLS certificate validation failed. | Keep SSL verification enabled and check the server CA bundle. |
| HTTP 401 / 403 | Authentication or access was rejected. | Check your API key and request headers. |
| HTTP 422 | Request validation failed. | Check required fields and their values. |
| HTTP 500 | Server-side application error. | Check response body and contact gateway support if necessary. |