Hirdetés
- iPhone topik
- Megjelent a Sony Xperia 10 VII
- Megérkezett a Google Pixel 7 és 7 Pro
- Huawei Watch Fit 3 - zöldalma
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Apple Watch Sport - ez is csak egy okosóra
- Google Pixel topik
- Apple iPhone 16 Pro - rutinvizsga
- Kézbe fogható paradoxon lett az iPhone Air
- Nagyon erős ajánlat lett az Apple Watch SE 3
Ú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
- BestBuy topik
- iPhone topik
- Megjelent a Sony Xperia 10 VII
- Bibliai bőség a Tesla negyedik mestertervében
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Otthoni hálózat és internet megosztás
- Gyúrósok ide!
- Borderlands 4
- Motorolaj, hajtóműolaj, hűtőfolyadék, adalékok és szűrők topikja
- Hardcore café
- További aktív témák...
- Megválnék a fotós arzenálomtól 6D MkII, Sigma üvegek, vakuk, és még sok más
- DELL T3620 WORKSTATION INTEL XEON I7-6700 / NVME SSD / DDR4 - vga tápkábel
- Gamer PC - R5 5500, RTX 2060 és 16gb RAM + GARANCIA
- 2025-Ös 10 Magos Legújabb Intel Core Ultra 5 225F 10x4.9Ghz RTX 5060TI 16/32Gb DDR5 5600Mhz 1TB M.2
- Ubiquiti UCG-Max-NS Cloud Gateway Max Unifi
- Lenovo Tab M10 HD 32GB, Kártyafüggetlen, 1 Év Garanciával
- Vadiúj videókártyák! Kamatmentes rèszletre is! Èrdeklődj!
- Xiaomi Redmi Note 12 Pro 5G 128GB Kártyafüggetlen 1Év Garanciával
- AKCIÓ! Dell Latitude 5550 notebook - Intel Ultra 7 165U 16GB DDR5 RAM 1TB SSD Intel Graphics WIN11
- Apple Watch Series 7 45mm GPS+Cellular, Kártyafüggetlen, 1 Év Garanciával
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest