How to use cURL?

im reading for: PHP: Spoof HTTP referer field with cURL.

<?php //Initiate cURL. $ch = curl_init(); //The URL cURL will be sending a request to. curl_setopt($ch, CURLOPT_URL, 'http://test.com/'); //The referer we will give the website above. curl_setopt($ch, CURLOPT_REFERER, 'https://m.facebook.com/'); //Follow any header redirects curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //If there is a redirect, we want to keep the referral URL we //set above. curl_setopt($ch, CURLOPT_AUTOREFERER, true); //Execute the cURL request. $result = curl_exec($ch); //Close the cURL handle. curl_close($ch); where can i add this code to work?