curl_exec


php128 apg

EXECUTE the cURL session.

This function should be called after initializing a cURL session and all the options for the session are set.



<?php

string
|bool curl_exec(CurlHandle $handle);

$handle A cURL handle returned by curl_init()

?>

 $handle 


The cURL handle returned by curl_init function.


  1 EXERCISE   

<?php

$url 
"https://www.google.com/";
// create a new cURL resource
$ch curl_init();

// set URL and other appropriate option

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

?>

 RESULT   

SEE the next exercises - other lessons!

  2 EXERCISE   

<?php

$url2 
"https://ed48.com/";
// create a new cURL resource
$ch2 curl_init();

// set URL and other appropriate options

// grab URL and pass it to the browser
curl_exec($ch2);

// close cURL resource, and free up system resources
curl_close($ch2);

?>

 RESULT   

SEE the next exercises - other lessons!