FLY TO THE ZENITH OF SUCCESS

Arun Raj.R (Software Engineer)

How to call url from php using C-url :: alternative to file_get_contents()

, , ,



This is a nice and simple substitute to get_file_contents() using curl, it returns FALSE if $contents is empty.

<?php
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
curl_close($c);

if ($contents) return $contents;
else return FALSE;
}
?>

Please Tell me what is Locale ?Take care while connecting a pendrive to your system !

Comments

Unregistered user Monday, March 22, 2010 4:10:46 PM

Nazrul Islam writes: Thanks.

Unregistered user Wednesday, November 30, 2011 3:21:41 PM

jeremie writes: Thanks ! It's a great alternative to get_contents !

Write a comment

New comments have been disabled for this post.

May 2012
M T W T F S S
April 2012June 2012
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31