Curl Example in PHP

Here is a sample script to use curl and check the output. You can use this script in your local server and if curl is installed then you will get simple output message from this website.
<?Php
$my_curl = curl_init(); 
$str="John";  // Change to your name
     
curl_setopt($my_curl, CURLOPT_URL, "https://www.plus2net.com/php_tutorial/curl-test.php?str=$str"); 
curl_setopt($my_curl, CURLOPT_RETURNTRANSFER, 1); 
$return_str = curl_exec($my_curl); 
curl_close($my_curl);
echo $return_str;
?>

Opening a URL by file_get_contents()



plus2net.com




Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer