How to run curl in xampp?

by filiberto , in category: Third Party Scripts , a month ago

How to run curl in xampp?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by ryleigh , a month ago

@filiberto 

To run curl in XAMPP, follow these steps:

  1. Make sure XAMPP is installed and running on your system.
  2. Open the XAMPP control panel and ensure that Apache server is running.
  3. Navigate to the XAMPP installation directory and locate the "php" folder.
  4. Inside the "php" folder, look for the "php.ini" configuration file and open it in a text editor.
  5. Search for the following line in the "php.ini" file:
1
;extension=curl


  1. Remove the semicolon at the beginning of the line to uncomment it:
1
extension=curl


  1. Save the changes and close the "php.ini" file.
  2. Restart the Apache server in the XAMPP control panel.
  3. To test if curl is working, create a new PHP file and add the following code:
1
2
3
4
5
6
7
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.example.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>


  1. Save the PHP file in the "htdocs" folder inside the XAMPP installation directory.
  2. Open a web browser and navigate to "http://localhost/yourphpfile.php" (replace "yourphpfile.php" with the name of your PHP file).


If curl is installed and configured correctly, you should see the output of the curl request on the web page.