Jump to content

CURL


fer0an

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/244668-curl/
Share on other sites

  • 2 months later...

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)

Link to comment
https://forums.phpfreaks.com/topic/244668-curl/#findComment-1284155
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.