Hi am trying to post some data on a website using CURL. The posting process has 3 steps. 1. enter a URL, submit and get to the 2nd step with some fields already completed 2. submit again, after you entered some more data and preview the form. 3. submit the final data.
Sorun, ikinci aşamasından sonra, form veri şöyle ki
POSTDATA =-----------------------------12249266671528
Content-Disposition: form-data; name="title"
Filme 2010, filme 2009, filme noi, programe TV, program cinema, premiere cinema, trailere filme - CineMagia.ro
-----------------------------12249266671528
Content-Disposition: form-data; name="category"
3
-----------------------------12249266671528
Content-Disposition: form-data; name="tags"
filme, programe tv, program cinema
-----------------------------12249266671528
Content-Disposition: form-data; name="bodytext"
Filme 2010, filme 2009, filme noi, programe TV, program cinema, premiere cinema, trailere filme
-----------------------------12249266671528
Content-Disposition: form-data; name="trackback"
-----------------------------12249266671528
Content-Disposition: form-data; name="url"
http://cinemagia.ro
-----------------------------12249266671528
Content-Disposition: form-data; name="phase"
2
-----------------------------12249266671528
Content-Disposition: form-data; name="randkey"
9510520
-----------------------------12249266671528
Content-Disposition: form-data; name="id"
17753
-----------------------------12249266671528--
Ben ikinci aşama için POST verilerinin bu tür üretecek bir algoritma hazırlamak için çalışıyorum şaşırıp. Sadece formun URL değiştirir asla söz. O her zaman: http://www.xxx.com/submit. I (faz = 1, faz = 2, faz = 3) şu anda ben adıma göre değişir "faz" adı verilen, sadece gizli bir giriş var. Herhangi bir yardım, ya kodu olması, pseudo-kod ya da sadece rehberlik büyük mutluluk duyacağız.
Şimdiye kadar benim kod:
function postBlvsocialbookmarkingcom($curl,$vars) {
extract($vars);
$baseUrl = "http://www.blv-socialbookmarking.com/";
//step 1: login
$curl->setRedirect();
$page = $curl->post ($baseUrl.'login.php?return=/index.php', array ('username' => $username, 'password' => $password, 'processlogin' => '1', 'return' => '/index.php'));
if ($err = $curl->getError ()) {
return $err;
}
//post step 1----
//get random key
$page = $curl->post($baseUrl.'/submit', array());
$randomKey = explode('<input type="hidden" name="randkey" value="',$page);
$randKey = explode('"',$randomKey[1]);
//-------------------------------------
$page = $curl->post($baseUrl.'/submit', array('url'=>$address,'phase'=>'1','randkey'=>$randKey[0],'id'=>'c_1'));
if ($err = $curl->getError ()) {
return $err;
}
//echo $page;
//
//post step 2
$page = $curl->post ($baseUrl.'/submit', array ('title' => $title, 'category'=>'1', 'tags' => $tags, 'bodytext' => $description, 'phase' => '2'));
if ($err = $curl->getError ()) {
return $err;
}
echo $page;
//post step 3
$page = $curl->post ($baseUrl.'/submit', array ('phase' => '3'));
if ($err = $curl->getError ()) {
return $err;
}
echo $page;
}