Test if cURL is working

Create a file called test-curl.php which includes the below script.
 
 
<?php
$ch = curl_init("http://www.google.com/");
$fp = fopen("google_homepage.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
 
 
After you execute or load this page the script will create a google_homepage.txt within the same directory that includes the source of the Google homepage. If you see the text file populated with the html source code of google.com, cURL is working.
  • 33 Users Found This Useful
Was this answer helpful?

Related Articles

What Is SSH?

SSH (Secure Shell) is a secure method for logging into a server remotely and giving the server...

How to request SSH Access

SSH access allows for a number of advanced functions and should only be requested by technically...

Block Access To Wordpress WP-Login.php

Add the following lines to your htaccess file located within your domains root.<Files...

What are cron jobs?

Cron jobs are routines that execute a script on any given interval. For instance, you may have a...

What are error pages?

Error pages are the pages displayed when a user tries to access a location on your site and...