Hirdetés
- iPhone topik
- Telekom mobilszolgáltatások
- Samsung Galaxy Note10 és Note10+ duplateszt
- „Új mérce az Android világában” – Kezünkben a Vivo X300 és X300 Pro
- Hivatalos a OnePlus 13 startdátuma
- Élő Fordítást hoz a Mikulás az európai AirPods tulajoknak
- Motorola Edge 70 - többért kevesebbet
- Xiaomi 15T Pro - a téma nincs lezárva
- Milyen okostelefont vegyek?
- Samsung Galaxy S24 Ultra - ha működik, ne változtass!
Új hozzászólás Aktív témák
-
Sk8erPeter
nagyúr
válasz
Lacces
#10560
üzenetére
Azért nem működik, mert be kell tenned még ezt:
// This will make cURL follow the redirects (@see http://stackoverflow.com/questions/6028050/curl-returntransfer-is-empty-curl-getinfo-error-1)
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);Tehát a teljes függvény:
/**
* Download a website or any other file using cURL
*
* @see http://www.jonasjohn.de/snippets/php/curl-example.htm
* @see http://stackoverflow.com/questions/6028050/curl-returntransfer-is-empty-curl-getinfo-error-1
*
* @param string $Url
* @return string
*/
function curl_download($Url){
// is cURL installed yet?
if (!function_exists('curl_init')){
die('Sorry cURL is not installed!');
}
// OK cool - then let's create a new cURL resource handle
$ch = curl_init();
// Now set some options (most are optional)
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $Url);
// This will make cURL follow the redirects (@see http://stackoverflow.com/questions/6028050/curl-returntransfer-is-empty-curl-getinfo-error-1)
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Set a referer
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
// User agent
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out 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);
return $output;
}Teszt:
$curl_download = curl_download('http://www.example.org/');
echo $curl_download;
Új hozzászólás Aktív témák
- EAFC 26
- Mibe tegyem a megtakarításaimat?
- sziku69: Szólánc.
- sziku69: Fűzzük össze a szavakat :)
- Luck Dragon: Asszociációs játék. :)
- Vicces képek
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Azonnali alaplapos kérdések órája
- Fortnite - Battle Royale & Save the World (PC, XO, PS4, Switch, Mobil)
- Anglia - élmények, tapasztalatok
- További aktív témák...
- Lenovo ThinkPad P15 Gen 2 - i7-11850H 32GB 1000GB Nvidia RTX A4000 8GB 1 év gar.
- BESZÁMÍTÁS! GIGABYTE Z370P PRO i7 9700 16GB DDR4 512GB SSD RTX 2070 SUPER 8GB CM TD500 700W
- Apple iPhone 13 128GB, Kártyafüggetlen, 1 Év Garanciával
- Apple iPhone 11 128 GB Fekete 1 év Garancia Beszámítás Házhozszállítás
- Apple MacBook Pro 13" 2019 256/8GB Akku:40 ciklus! Magyar
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Promenade Publishing House Kft.
Város: Budapest


