Horje
How to add a url with php_curl fuctionally cURL

Use cURL. This function is an alternative to file_get_contents.


Extract a source code of a URL with php_curl

Use cURL. This function is an alternative to file_get_contents.
index.php
Example: PHP
<?php
function url_get_contents ($Url) {
    if (!function_exists('curl_init')){ 
        die('CURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}

$url = 'https://horje.com';

echo url_get_contents($url);
?>

Output should be:





php curl

Related Articles
How to create title to url/slug in PHP PHP Function Tutorial
How to minify all html in a single line with PHP PHP Function Tutorial
How to add a url with php_curl fuctionally cURL PHP Function Tutorial


Type:
Develop
Category:
Web Tutorial
Sub Category:
PHP Function Tutorial
Uploaded by:
Admin