@filiberto
To run curl in XAMPP, follow these steps:
- Make sure XAMPP is installed and running on your system.
- Open the XAMPP control panel and ensure that Apache server is running.
- Navigate to the XAMPP installation directory and locate the "php" folder.
- Inside the "php" folder, look for the "php.ini" configuration file and open it in a text editor.
- Search for the following line in the "php.ini" file:
- Remove the semicolon at the beginning of the line to uncomment it:
- Save the changes and close the "php.ini" file.
- Restart the Apache server in the XAMPP control panel.
- 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);
?>
|
- Save the PHP file in the "htdocs" folder inside the XAMPP installation directory.
- 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.