function postdata($url, $string="", $reffer="http://www.blabla.com/bla"){ $cookiefile = "ck/fl.txt"; $agent="Mozilla/14.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, $reffer); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); $result = curl_exec ($ch); curl_close ($ch); return $result; }
Oraz problem - linię z CURLOPT_FOLLOWLOCATION, ze względu na ograniczenia hostingu (open_basedir) nie działa.
Niestety bez niej kod również nie działa tak jak powinien. Znalazłem rozwiązanie, inną funkcję dostępną tu:
http://pl.php.net/manual/pl/function.curl-setopt.php#79787 lecz nie wiem jak mam te dwie części ze sobą połączyć.
Proszę o pomoc.