fer0an Posted August 13, 2011 Share Posted August 13, 2011 Hello I want download a webpage with curl on my host using php. but when I use curl didn't download this page, if I change curl to file_get_contents and use it download this page. please help me to resolve my problem. URL is : www.ebook33.com CUL code is : function Get($url) { $hCurl = curl_init($url); curl_setopt($hCurl, CURLOPT_RETURNTRANSFER, TRUE); $ret = curl_exec($hCurl); curl_close($hCurl); return ($ret); File get content code is : file_get_contents($url); Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/ Share on other sites More sharing options...
trq Posted August 13, 2011 Share Posted August 13, 2011 What is the question? Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1256723 Share on other sites More sharing options...
fer0an Posted August 13, 2011 Author Share Posted August 13, 2011 I want download webpage www.ebook33.com using curl. but curl didn't work with my code. I need help to download this page using curl. Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1256728 Share on other sites More sharing options...
fer0an Posted August 13, 2011 Author Share Posted August 13, 2011 anyone can help me? Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1256736 Share on other sites More sharing options...
trq Posted August 13, 2011 Share Posted August 13, 2011 You haven't given us enough information about your actual issue. Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1256768 Share on other sites More sharing options...
plznty Posted August 13, 2011 Share Posted August 13, 2011 Why do you want to use cURL rather than file_get_contents. Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1256788 Share on other sites More sharing options...
fer0an Posted August 14, 2011 Author Share Posted August 14, 2011 because curl using less proccess Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1256998 Share on other sites More sharing options...
plznty Posted November 2, 2011 Share Posted November 2, 2011 function curl_get_contents($url) { // Initiate the curl session $ch = curl_init(); // Set the URL curl_setopt($ch, CURLOPT_URL, $url); // Removes the headers from the output curl_setopt($ch, CURLOPT_HEADER, 0); // Return the output instead of displaying it directly curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Execute the curl session $output = curl_exec($ch); // Close the curl session curl_close($ch); // Return the output as a variable return $output; } then call curl_get_contents($var) Quote Link to comment https://forums.phpfreaks.com/topic/244668-curl/#findComment-1284155 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.