Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

screwtape_mk's avatar

cURL in Laravel and goDaddy API

I am making a domain purchase call via the godaddy API. I have been successful purchasing a domain on their test environment: https://developer.godaddy.com/doc/endpoint/domains

                
                $bodyContent=json_encode($bodyContent);

                $ch = curl_init();
                $timeout=60;
                
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); 
                curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyContent);
                curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);

                $result = curl_exec($ch);

                $dn = json_decode($result,true);
                $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

                dd($http_status);

When i now try and do this on laravel and dd(http_status) i get a 404 error. I can provide more details on the $bodyContent but for now just know the same variable works fine in the godaddy environment. I am new to curl so something must be wrong in the above code snippet

0 likes
1 reply
guybrush_threepwood's avatar

Could you check the the error message to see if there's additional information?

dd(curl_error($ch));

Please or to participate in this conversation.