Werbung
Werbung
Werbung
Archive
Folge uns auf Twitter
Werbung

Jede Menge neue Twitter Follower bekommen. Die Software hat einen kostenlosen Trial Mode, der bis zu 250 Follower bringt.

Willkommen
Willkommen im PHP Archiv Blog! Hier gibts Infos zum Thema PHP Codeschnipsel und Tipps. Bei unserem Projekt phparchiv.de, finden Sie über 5700 Scripte.

Einfaches Beispiel für die Anwendung von cURL

function DownloadUrl($Url){

// is curl installed?
if (!function_exists('curl_init')){
die('CURL is not installed!');
}

// create a new curl resource
$ch = curl_init();

/*
Here you find more options for curl:

http://www.php.net/curl_setopt

*/

// set URL to download
curl_setopt($ch, CURLOPT_URL, $Url);

// set referer:
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");

// user agent:
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");

// remove header? 0 = yes, 1 = no
curl_setopt($ch, CURLOPT_HEADER, 0);

// should curl return or print the data? true = return, false = print
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

// download the given URL, and return output
$output = curl_exec($ch);

// close the curl resource, and free system resources
curl_close($ch);

// print output
return $output;
[/php]

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>