PHP Curl Not wanting to connect to localhost.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew3360
    New Member
    • May 2023
    • 5

    PHP Curl Not wanting to connect to localhost.

    Hi,
    I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a 404 error when i try and connect. How could i fix this.
    Code:
     $concurl = curl_init();
       curl_setopt($concurl, CURLOPT_URL, "http://localhost/user-validation.php?somevalue=userid");
       curl_setopt($concurl,CURLOPT_RETURNTRANSFER, true);
       
       $response = curl_exec($concurl);
       curl_close($concurl);
       
          echo $response;


    Thanks,
    matthew
  • Niheel
    Recognized Expert Moderator Top Contributor
    • Jul 2005
    • 2433

    #2
    Can you check to see if you have CURL enabled in your local PHP installment?

    Are you using XAMP or anything similar for local development? What OS?


    Niheel
    Bytes
    niheel @ bytes

    Comment

    Working...