hoho Posted August 5, 2009 Report Share Posted August 5, 2009 Izmantoju Curl lai ar Post metodu nodot datus uz citu web lapu. bet redirekts nenotiek, kaapeec taa? dalja no koda: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // set url to post to curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result; Quote Link to comment Share on other sites More sharing options...
ohmygod Posted August 5, 2009 Report Share Posted August 5, 2009 Kādam redirektam būtu jānotiek? Quote Link to comment Share on other sites More sharing options...
hoho Posted August 5, 2009 Author Report Share Posted August 5, 2009 Man vajag lai notiktu redirekts uz $url! Nu nevis ar Header("Location ... Bet lai visi POST datu suutas uz šo $url! Quote Link to comment Share on other sites More sharing options...
bubu Posted August 5, 2009 Report Share Posted August 5, 2009 Taisi to POST pieprasījumu uzreiz uz to URL'i, kurš padodas Location'ā. Quote Link to comment Share on other sites More sharing options...
hoho Posted August 5, 2009 Author Report Share Posted August 5, 2009 a ko var dariit, ja man vajag saakumaa datus saglabaat savaa datubazee un peec tam veel nosuutiit ar post uz citu WWW? taapeec es arii domaaju, peec Submita 1) saglabaaju datus 2) ar CURL suutu uz citu formu ... ?! Quote Link to comment Share on other sites More sharing options...
Kaklz Posted August 5, 2009 Report Share Posted August 5, 2009 tad tieši tā arī dari - saglabā datus pie sevis un ar curl sūti uz ārēju URL. Atceries vien, ka POST curl gadījumā nekādi nenozīmē kaut kādas lietotāja pārsūtīšanas uz citurieni. ja tu gribi pēc tam lietotāju kaut kur redirektēt, tad to pēc curl darbībām vienkārši izdari ar header(location:), piemēram mysql_query("insert into data (val1, val2) values ('a', 'b')"); curl_exec un viss pārējais header('location: /vieta_kur_parsutit_lietotaju'); Quote Link to comment Share on other sites More sharing options...
hoho Posted August 5, 2009 Author Report Share Posted August 5, 2009 Paldies! Es domaaju, ka ar Curl var kaut ka to redirektu uztaisiit! :) tagad viss straadaa! :) Quote Link to comment Share on other sites More sharing options...
hoho Posted August 5, 2009 Author Report Share Posted August 5, 2009 hm, a vispaar nee, nestraadaa kaa vajag, sorry! man tak jaasuuta tie dati uz $url arii ar POST metodi, lai tas skripts vareetu apstraadaat datus. taapeec Header(Location.... nestraadaa, tas ir tikai redirekts bez POST datiem! Quote Link to comment Share on other sites More sharing options...
bubu Posted August 5, 2009 Report Share Posted August 5, 2009 Tu tur gribi pārsūtīt uz citu savu rakstītu skriptu? Tad nevajag nekādu header("Location.. Vajag lietot normālas funkcijas un include/require. 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.