Hu Gb

PHP cURL basics

2009.07.28
With the cURL library we can make even complicated http requests with ease. Let's see first how can we open a webpage:
#start the cURL session
$ch = curl_init();
#set the settings
#URL
curl_setopt($ch, CURLOPT_URL, "google.com");
#we don't want to output the result
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
#make the request
$result= curl_exec($ch);
#close the session to free up the resources
curl_close($ch);
Továbbolvas