EdgarsK Posted June 22, 2009 Report Share Posted June 22, 2009 (edited) Sveiki, ir nakts vidus un censhos izprast kas man ir par kljudu, ceru ka kads man palidzes. 1) caur CURL atveram sezonu, sanjemam cookies, execejam, aizveram sezonu 2) caur CURL atveram sezonu, izveidojam datus ko sutit caur post, ieliekam phpsess cookiju, execejam, aizveram sezonu Itka viss izklausas pareizi, bet pretim sanjemu 411 - Length Required Tad pievienoju (2) darbibais HTTPHEADER iedalu Content-Size: strlen(mani_postetie_dati) Izmainu nav, joprojam 411.. ko darit ? ka pareizi sastadit httpheader ( es pienjemu ka tas ir vainigs pie error ) 1. Atveram, sanjemam cookies, execejam, aizveram $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,"http://www.lapa.lv"); curl_setopt($ch,CURLOPT_COOKIEJAR,dirname(__FILE__)."/cookie.ini"); curl_exec($ch); curl_close($ch); 2. Atveram, ieliekam post datus, sesiju, execejam, aizveram $header[] = "Content-Length: ".strlen($fields_str); $ch = curl_init(); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_str); curl_setopt($ch,CURLOPT_URL,"http://www.lapa.lv"); curl_setopt($ch,CURLOPT_HTTPHEADER,$header); curl_setopt($ch,CURLOPT_COOKIE,"PHPSESSID=$phpses"); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $body=curl_exec($ch); curl_close($ch); Edited June 22, 2009 by EdgarsA Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted June 22, 2009 Author Report Share Posted June 22, 2009 Vai tiesam neviens ? :( Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.