How to properly use curl_init for a GET request in PHP? or What's the correct way to handle a curl_in

18 Replies, 1480 Views

Have you tried dumping the HTTP status code? Sometimes the request works but returns a 404 or 500.

```php
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "Status: " . $httpCode;
```

If it’s 0, the request didn’t even reach the server. Could be a DNS or network issue.

Messages In This Thread



Users browsing this thread: 1 Guest(s)