waplet Posted February 4, 2010 Report Share Posted February 4, 2010 Meklēju google kā arī lv.php.net/cUrl.. bet neko neatradu par sesijām.. Vai ir iespējams.. nosūtīt POST vai GET .. ielogoties, saņemt to sesiju un ar to sesiju tālāk darīt visādas lietas? Link to comment Share on other sites More sharing options...
EdgarsK Posted February 4, 2010 Report Share Posted February 4, 2010 (edited) protams ka ir :) piem vari uploadot failus $ch = curl_init(); $data = array('name' => 'Foo', 'file' => '@/home/user/test.png'); curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); kurla darbojās aptveni šādi <? // uzsakam sesiju $ch = curl_init();[/color] // urla kur iesim curl_setopt($ch,CURLOPT_URL,'http://php.lv/f'); // ja gribi sanjemt atpakaļ saturu piemet klat RETURNTRANSFER curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); // un palaid $e = curl_exec($ch); curl_close($ch); ?> es te nesen biju iemetis ka es caur curl savacu ehr top listi, http://paste.php.lv/...0f82d4?lang=php EDIT Atceries , lai darbinātu kurlu, tev vajag ieslegt php_ini.. extenshenu, pateiksu prieks ;) php_curl.dll/so Edited February 4, 2010 by EdgarsA Link to comment Share on other sites More sharing options...
waplet Posted February 4, 2010 Author Report Share Posted February 4, 2010 Neredzeju nevienu vietu, kur buut mmineets par sessijas apstradi utt Link to comment Share on other sites More sharing options...
krikulis Posted February 4, 2010 Report Share Posted February 4, 2010 Jaa, cookijus pieseivot var kjipa shitaa curl_setopt($curl_handle, CURLOPT_COOKIEFILE, 'cookiefile.txt'); curl_setopt($curl_handle, CURLOPT_COOKIEJAR, 'cookiefile.txt'); vispaar stipri eertaak ir straadaat ar http://www.php.net/http Link to comment Share on other sites More sharing options...
EdgarsK Posted February 4, 2010 Report Share Posted February 4, 2010 (edited) uj :) piedod <?php function read_header($ch, $string) { global $cookiearr; global $ch; $length = strlen($string); if(!strncmp($string, "Location:", 9)) { $location = trim(substr($string, 9, -1)); } if(!strncmp($string, "Set-Cookie:", 11)) { $cookiestr = trim(substr($string, 11, -1)); $cookie = explode(';', $cookiestr); $cookie = explode('=', $cookie[0]); $cookiename = trim(array_shift($cookie)); if($cookiename) { $cookiearr[$cookiename] = trim(implode('=', $cookie)); } } $cookie = ""; if(trim($string) == "") { if(!empty($cookiearr)) foreach ($cookiearr as $key=>$value) { $cookie .= "$key=$value; "; } $cookie=str_replace(" ","",$cookie); curl_setopt($ch, CURLOPT_COOKIE, $cookie); } return $length; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://php.lv"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header'); $html = curl_exec($ch); ?> krikuli - tavs cookiejar variants ir galigi garam, vins ir chakarigs daziem strada daziem ne, kautkadi chmodi jaskatas etc.. lieks chakars Edited February 4, 2010 by EdgarsA Link to comment Share on other sites More sharing options...
waplet Posted February 4, 2010 Author Report Share Posted February 4, 2010 Nu kāpēc par kūkijiem... man vajag sesijas vilkt līdzi... vai tas vispār ir iespējams? Link to comment Share on other sites More sharing options...
EdgarsK Posted February 4, 2010 Report Share Posted February 4, 2010 Nu kāpēc par kūkijiem... man vajag sesijas vilkt līdzi... vai tas vispār ir iespējams? luk es tev iedevu funkciju kura savac gan cukijus gan sesiju tak ta ir hedera funkcija, kura savac savejerus vaitad ne ta ? es nesmu gan sekojis lidzi vai tur sez abi divi, bet liekas ka butu jasez. Link to comment Share on other sites More sharing options...
waplet Posted February 4, 2010 Author Report Share Posted February 4, 2010 Paldies par palīdzību, tas biaj ātri :) viss stradā. Link to comment Share on other sites More sharing options...
Recommended Posts