Reply
Example for cURL ?
Old 06-23-2007, 10:21 AM Example for cURL ?
Average Talker

Posts: 28
Can anyone please provide your own example for cURL ?
pulikuttann is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-23-2007, 01:06 PM Re: Example for cURL ?
camperjohn's Avatar
Ultra Talker

Posts: 268
Location: San Diego
Code:
// Try to use file_get_contents, if it failes, try with cURL
function curl_get_contents($u)
{
    $data = @file_get_contents($u);

    if ($data === false)
    {
	  $c = curl_init();
	  curl_setopt($c, CURLOPT_URL, $u);
	  curl_setopt($c, CURLOPT_HEADER, 0);
	  curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
	  $data = curl_exec($c);
	  curl_close($c);
    }

    return $data;
}
camperjohn is offline
Reply With Quote
View Public Profile Visit camperjohn's homepage!
 
Reply     « Reply to Example for cURL ?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.64605 seconds with 12 queries