HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > PHP
   
 
 
Опции темы Поиск в этой теме Опции просмотра

Парсинг формы для гет/пост запроса
  #1  
Старый 17.04.2009, 05:57
rcc0023
Участник форума
Регистрация: 03.07.2008
Сообщений: 177
С нами: 9398085

Репутация: 11
По умолчанию Парсинг формы для гет/пост запроса

Есть ли готовые варианты (с script изменением) для подготовки запроса? То есть есть форма:

Цитата:
<form name=log action='login.php' method=post><input type=hidden name=LOGIN_redirect value=1>

<input name="login" type="text" maxlength=150 class="id" title='Логин в игре'
value=' Имя персонажа' onfocus="clearLogin();">
<input name="pass" class="id2" type="password" maxlength=20 title='Пароль в игре' value='12345678901234567890' onfocus="clearPassw();">
<input type=hidden name="preseted" value=0>
<input type=image name=lbut src='i/index/left_buttons21.jpg' title='Войти в игру!'></form>

<script type="text/javascript"> function clearLogin() { if (log.lreseted.value == 0) { log.login.value= ''; log.lreseted.value = 1; } } function clearPassw() { if (log.preseted.value == 0) { log.pass.value= ''; log.preseted.value = 1; } } </script>

запрос брал так...
PHP код:
 $lbutx=rand(1,57); $lbuty=rand(1,17);  $game_login_u=rawurlencode($game_login); $game_pass_u=rawurlencode($game_pass);  $html=file_get_contents($url.'index.php');  $html=str_replace('"','',$html); $html=str_replace("'",'',$html); $html=str_replace('>',' >',$html); $html_2=str_replace(' ','',$html);  $text_01='<input';  $text_1=explode($text_01,$html); $text_2=explode('<form',$html); $text_3=explode('>',$text_2); $text_12=explode('name=',$text_3); $text_13=explode(' ',$text_12); $text_14=explode('action=',$text_3); $text_15=explode(' ',$text_14);  $f_forma_name=$text_13$f_forma_action=$text_15;  $no_error_1=substr_count($html,$text_01);  while($no_error_1 >= $key){  $html_str2=explode('>',$text_1);  $html_str=$html_str2;  $text_4=explode('name=',$html_str); $text_5=explode(' ',$text_4); $text_6=explode('type=',$html_str); $text_7=explode(' ',$text_6); $text_8=explode('value=',$html_str); $text_9=explode(' ',$text_8); $text_10=explode($f_forma_name.'.'.$text_5.'.value=',$html_2); $text_11=explode(';',$text_10);  $f_name=$text_5$f_type=$text_7$f_value=$text_9$f_java_value=$text_11;  $limit_1=substr_count($html,$f_forma_name.'.'.$f_name.'.value'); $limit_2=substr_count($html_str,'Логин'); $limit_3=substr_count($html_str,'Имя персонажа');  if($data_form_auth!='' and $znak!='&'){$znak='&';};      if($f_type=='password'){$data_form_auth.=$znak.''.$f_name.'='.$game_pass_u;} elseif(($limit_2 || $limit_3 0) and $f_type=='text'){$data_form_auth.=$znak.$f_name.'='.$game_login_u;} elseif($limit_1==2){$data_form_auth.=$znak.$f_name.'='.$f_java_value;} elseif($f_type=='image' and $f_name=="lbut"){$data_form_auth.=$znak.'lbut.x='.$lbutx.'&lbut.y='.$lbuty;} elseif($f_type=='hidden'){$data_form_auth.=$znak.$f_name.'='.$f_value;};  ++$key;                           }; 
в итоге получалось по типу такого: login=rcc0023&pass=hohoho&preseted=1

Как можно сделать оптимальней?

Последний раз редактировалось rcc0023; 17.04.2009 в 14:17..
 
Ответить с цитированием
 



Предыдущая тема Следующая тема
Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Books PSalm69 Избранное 273 13.02.2016 01:24



Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.