DataKL Hosting
Please Login or Register

Knowledgebase

cURL Code Sample

cURL is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE and LDAP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication, file transfer resume, proxy tunneling, etc.

cURL is commonly needed for API communications between remote servers.


<?php
$site_url = 'http://example.com';
$ch = curl_init();$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $site_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
ob_start();
curl_exec($ch);
curl_close($ch);
$file_contents = ob_get_contents();
ob_end_clean();

echo $file_contents;
?>



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read

Powered by WHMCompleteSolution

Quick Navigation

Client Login

Email

Password

Remember Me

Search