Visa ett inlägg
Oläst 2011-11-12, 23:53 #11
Malte Malte är inte uppkopplad
Nykomling
 
Reg.datum: Nov 2011
Inlägg: 16
Malte Malte är inte uppkopplad
Nykomling
 
Reg.datum: Nov 2011
Inlägg: 16
cURL är som sagt att föredra samt så har alla vanliga webbhotell stöd för det.

Jag skulle nog ha gjort någon sånt här
PHP-kod:
//cURL funktion som ersätter file_get_contents();
function get_contents($url)
{
  
$ch curl_init();
  
$timeout 5;
  
curl_setopt($ch,CURLOPT_URL,$url);
  
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
  
$contents curl_exec($ch);
  
curl_close($ch);
  return 
$contents;
}


//hämtar datan och skriver till filen "filen.txt"
$data get_contents("http://www.wn.se/"); 
$fp fopen('data/filen.txt''w'); 
fwrite($fp$data); 
fclose($fp); 
Malte är inte uppkopplad   Svara med citatSvara med citat