За последние 24 часа нас посетили 55596 программистов и 1728 роботов. Сейчас ищут 822 программиста ...

CURL - 400 Bad Request

Тема в разделе "Прочие вопросы по PHP", создана пользователем Макс1, 11 сен 2015.

  1. Макс1

    Макс1 Активный пользователь

    С нами с:
    11 сен 2015
    Сообщения:
    6
    Симпатии:
    0
    Необходимо установить на МФУ Canon через web-интерфейс параметры копирования. С использованием CURL проходит вход в систему, первый вызов функции Submit работает, входит в систему и получает Cookie. Второй вызов функции при попытке изменить число копий отправляет Cookie (без отправки выводила сообщение, что время сессии истекло), но страница выводит сообщение Bad Request.

    Код (PHP):
    1. HTTP/1.1 400 Bad Request
    2. Set-Cookie: sessid=UFgBfIzlRnOM3x8tkxnNrA##;path= /
    3. pragma: no-cache
    4. Cache-Control: no-store, no-cache, max-age=0
    5. expires: Thu,01 Jan 1970 00:00:00 GMT
    6. Accept-Ranges: bytes
    7. Connection: close
    8.  
    9. <HTML>
    10. <HEAD>
    11.   <TITLE> 400 Bad Request </TITLE>
    12. </HEAD>
    13. <BODY>
    14.   <H1> Bad Request </H1>
    15.   <HR>
    16. </BODY>
    17. </HTML>
    18.  
    Используется следующий скрипт и запускается в командной строке php curl.php. Пытаюсь установить 40 копий.

    Код (PHP):
    1. <?php
    2. Submit('i0017=2&i0019=1&submitButton=Вход в систему', 'http://192.168.1.102', 'http://192.168.1.102/checkLogin.cgi', 1);
    3. Submit('i0014=40&submitButton=OK', 'http://192.168.1.102/f_copy_edit.html', 'http://192.168.1.102/cgi/f_copy_edit.cgi', 2);
    4.  
    5. function Submit($PostFields, $Referer, $URL, $cookie)
    6. {
    7. if( $curl = curl_init() )
    8. {
    9. if ($cookie==1) curl_setopt($curl, CURLOPT_COOKIEJAR, '/srv/www/htdocs/php/test/sessid');
    10. if ($cookie==2) curl_setopt($curl, CURLOPT_COOKIEFILE, '/srv/www/htdocs/php/test/sessid');
    11. curl_setopt($curl, CURLOPT_POSTFIELDS, $PostFields);
    12. curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla 4.0 (compatible; MSIE 6.0; Win32');
    13. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    14. curl_setopt($curl, CURLOPT_URL, $URL);
    15. curl_setopt($curl, CURLOPT_HEADER, true);
    16. curl_setopt($curl, CURLOPT_REFERER, $Referer);
    17. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
    18. curl_setopt($curl, CURLOPT_POST, true);
    19. $out = curl_exec($curl);
    20. echo $out;
    21. curl_close($curl);
    22. }
    23. }
    24. ?>
    Исходный код главной страницы, с которой работает вход в систему.

    Код (PHP):
    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2. <html xmlns="http://www.w3.org/1999/xhtml">
    3. <head>
    4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    5. <meta http-equiv="content-script-type" content="text/javascript" />
    6. <meta http-equiv="content-style-type" content="text/css" />
    7. <meta http-equiv="pragma" content="no-cache" />
    8. <meta http-equiv="cache-control" content="no-cache,no-store,max-age=0" />
    9. <meta http-equiv="expires" content="Thu, 01 Jan 1970 00:00:00 GMT" />
    10. <link rel="shortcut icon" type="image/x-icon" href="/media/favicon.ico" />
    11. <link rel="icon" type="image/x-icon" href="/media/favicon.ico" />
    12. <link rel="stylesheet" type="text/css" media="all" href="/css/common.css" />
    13. <link rel="stylesheet" type="text/css" media="all" href="/css/login.css" />
    14. <link rel="stylesheet" type="text/css" media="all" href="/css/ot.css" />
    15.  
    16. <script type="text/javascript" src="/js/rui.js"></script>
    17. <script language="javascript">
    18. <!--
    19. function unloadFunc(e){}
    20. registEvent(window,"unload",unloadFunc);
    21. // -->
    22. </script>
    23. <script language="javascript">
    24. <!--
    25. function validate(e){
    26. buttonDisabled();
    27. document.forms[0].submit();
    28. return true;
    29. }
    30. function changeMode(obj){
    31. if(obj.name=="i0012" || obj.name=="i0016" || obj.name=="i0014"){
    32. document.forms[0].i0012A.checked=true;
    33. document.forms[0].i0017A.checked=false;
    34. }
    35. else{
    36. document.forms[0].i0012A.checked=false;
    37. document.forms[0].i0017A.checked=true;
    38. }
    39. }
    40. function initControls(e){
    41. var errCd = getQueryValue("err", "");
    42. if(errCd == "1"){
    43. alert("Неправильные сведения для аутентификации.\nВведите заново.");
    44. document.location="/";
    45. }
    46. registEvent($I("submitButton"),"click",validate);
    47. }
    48. registEvent(window,"load",initControls);
    49. // -->
    50. </script>
    51. <title>Удаленный ИП: Вход в системуimageRUNNER1133 series:imageRUNNER1133 series</title>
    52. </head>
    53. <body>
    54. <div id="container">
    55. <div id="loginWindow">
    56. <div id="loginHeader">
    57. <div id="corporateBranding">
    58. <img src="/media/canonlogo.gif" alt="" title="" />
    59. </div>
    60. <div id="windowTitle">
    61. <h1>Вход в систему</h1>
    62. <p id="deviceType">
    63. <span id="deviceName">imageRUNNER1133 series / imageRUNNER1133 series / </span>
    64. </p>
    65. </div>
    66. <hr />
    67. </div>
    68. <form name="loginFrm" action="/checkLogin.cgi" autocomplete="off" method="post" onsubmit="return false;">
    69.  
    70. <input type="hidden" name="iToken" id="iToken" value="" />
    71.  
    72. <div id="login_contentsArea">
    73. <div id="loginContentsWrapper">
    74. <div id="loginContents">
    75. <div class="LoginModule">
    76. <table class="PropertyListComponent">
    77. <tbody>
    78.  
    79. <tr>
    80. <th colspan="2"><input type="radio" name="i0012" id="i0012A" value="1" onclick="changeMode(this)" /><label for="i0012A">Режим управления</label><br />
    81. </th>
    82. </tr>
    83. <tr class="Sub">
    84. <th>ИД администратора системы:</th>
    85. <td><input type="text" name="i0014" id="i0014" class="Size_shortest" value="" maxlength="7" onfocus="changeMode(this)" autocomplete="off" />
    86. </td>
    87. </tr>
    88. <tr class="Sub">
    89. <th>PIN администратора системы:</th>
    90. <td><input type="password" name="i0016" id="i0016" class="Size_shortest" value="" maxlength="7" onfocus="changeMode(this)" autocomplete="off" />
    91. </td>
    92. </tr>
    93. <tr>
    94. <th colspan="2"><input type="radio" name="i0017" id="i0017A" value="2" checked='checked' onclick="changeMode(this)" /><label for="i0017A">Режим пользователя</label><br />
    95. </th>
    96. </tr>
    97. <tr class="Sub">
    98. <th>Имя пользователя:</th>
    99. <td><input type="text" name="i0019" id="i0019" class="Size_shortest" value="" maxlength="32" onfocus="changeMode(this)" autocomplete="off" />
    100. </td>
    101. </tr>
    102.  
    103. <!--
    104. <tr>
    105. <th></th>
    106. <td></td>
    107. </tr>
    108. <tr>
    109. <th></th>
    110. <td></td>
    111. </tr>
    112. -->
    113. </tbody>
    114. </table>
    115. </div>
    116. <div class="LoginOperation">
    117. <fieldset>
    118. <input type="submit" id="submitButton" class="ButtonEnable" value="Вход в систему" />
    119. </fieldset>
    120. </div>
    121. </div>
    122. </div>
    123. </div>
    124. </form>
    125. <hr />
    126. <div id="applicationInfo">
    127. <address class="SiteInforLegal">Copyright CANON INC. 2011 All Rights Reserved</address>
    128. </div>
    129. </div>
    130. </div>
    131. </body>
    132. </html>
    Исходный код страницы f_copy_edit.html, с которой не работает переход через CURL на страницу f_copy.html с помощью файла f_copy_edit.cgi Осторожно, длинный код.

    Код (PHP):
    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2. <html xmlns="http://www.w3.org/1999/xhtml">
    3. <head>
    4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    5. <meta http-equiv="content-script-type" content="text/javascript" />
    6. <meta http-equiv="content-style-type" content="text/css" />
    7. <meta http-equiv="pragma" content="no-cache" />
    8. <meta http-equiv="cache-control" content="no-cache,no-store,max-age=0" />
    9. <meta http-equiv="expires" content="Thu, 01 Jan 1970 00:00:00 GMT" />
    10. <link rel="shortcut icon" type="image/x-icon" href="/media/favicon.ico" />
    11. <link rel="icon" type="image/x-icon" href="/media/favicon.ico" />
    12. <link rel="stylesheet" type="text/css" media="all" href="/css/common.css" />
    13. <link rel="stylesheet" type="text/css" media="all" href="/css/system_default.css" />
    14. <link rel="stylesheet" type="text/css" media="all" href="/css/ot.css" />
    15. <script type="text/javascript" src="/js/layoutFix_ie6.js"></script>
    16. <script type="text/javascript" src="/js/rui.js"></script>
    17. <script language="javascript">
    18. <!--
    19. function unloadFunc(e){}
    20. registEvent(window,"unload",unloadFunc);
    21. // -->
    22. </script>
    23. <script language="javascript">
    24. <!--
    25. function setControl001(){
    26. setControls(true, "i0020B", "i0029", "i0031", "i0033", "i0035");
    27. }
    28. function setControl002(){
    29. if(document.forms[0].i0024A){
    30. setControls(false, "i0024A", "i0025");
    31. if(document.forms[0].i0024A.checked == true){
    32. document.forms[0].i0047.value = 1;
    33. setControl004();
    34. }
    35. }
    36. }
    37. function setControl003(){
    38. setControls(true, "i0024B", "i0025");
    39. }
    40. function setControl004(){
    41. setControls(16, "i0047", "i0050A", "i0050B", "i0050C", "i0050D", "i0050E", "i0050F", "i0050G", "i0050H", "i0050I");
    42. if(document.forms[0].i0050A.disabled == true){
    43. setControls(18, "i0047", "i0050A", "i0050B", "i0050C", "i0050D", "i0050E", "i0050F", "i0050G", "i0050H", "i0050I");
    44. }
    45. if(document.forms[0].i0024B){
    46. if(document.forms[0].i0047.value != 1){
    47. document.forms[0].i0024B.checked = true;
    48. setControl003();
    49. }
    50. }
    51. }
    52. function setControl009(){
    53. setControls(0, "i0062", "i0063");
    54. if(document.forms[0].i0053){
    55. if(($IV("i0062",0) == 6) || (($IV("i0062",0)==0)&&($IV("i0063",25)==100))){
    56. if(document.forms[0].i0053.value == 0){
    57. setSelectMagnification();
    58. } else {
    59. setSelectDuplex(document.forms[0]);
    60. }
    61. } else {
    62. setSelectMagnification();
    63. }
    64. } else {
    65. setSelectMagnification();
    66. }
    67. }
    68. function setControl010(){
    69. setControls(3, "i0069", "i0071");
    70. if(document.forms[0].i0071.disabled == true) {
    71. setControls(4, "i0069", "i0071");
    72. }
    73. setControls(3, "i0069", "i0002A", "i0002B");
    74. if(document.forms[0].i0002A.disabled == false){
    75. document.forms[0].i0002A.checked = true;
    76. }
    77. setControls(4, "i0069", "i0002C", "i0002D", "i0002E", "i0002F");
    78. if(document.forms[0].i0002C.disabled == false){
    79. document.forms[0].i0002C.checked = true;
    80. }
    81. setControls(2, "i0069", "i0078", "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B", "i0062", "i0063");
    82. if(document.forms[0].i0062.disabled == true) {
    83. setControls(3, "i0069", "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B", "i0062", "i0063");
    84. if(document.forms[0].i0062.disabled == true) {
    85. setControls(4, "i0069", "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B", "i0062", "i0063");
    86. }
    87. }
    88. if(document.forms[0].i0053) {
    89. if(document.forms[0].i0053.disabled == false) {
    90. setControl007();
    91. }
    92. }
    93. if(document.forms[0].i0062) {
    94. if(document.forms[0].i0062.disabled == false) {
    95. setControl009();
    96. }
    97. }
    98. if((document.forms[0].i0069.value == 3) || (document.forms[0].i0069.value == 4)) {
    99. setMagnification(document.forms[0]);
    100. }
    101. }
    102. function setControl011(){
    103. setControls(3, "i0069", "i0071");
    104. if(document.forms[0].i0071.disabled == true) {
    105. setControls(4, "i0069", "i0071");
    106. }
    107. setControls(3, "i0069", "i0002A", "i0002B");
    108. setControls(4, "i0069", "i0002C", "i0002D", "i0002E", "i0002F");
    109. setControls(2, "i0069", "i0078", "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B", "i0062", "i0063");
    110. if(document.forms[0].i0062.disabled == true) {
    111. setControls(3, "i0069", "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B", "i0062", "i0063");
    112. if(document.forms[0].i0062.disabled == true) {
    113. setControls(4, "i0069", "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B", "i0062", "i0063");
    114. }
    115. }
    116. if(document.forms[0].i0053) {
    117. if(document.forms[0].i0053.disabled == false) {
    118. setControl007();
    119. }
    120. }
    121. if(document.forms[0].i0062) {
    122. if(document.forms[0].i0062.disabled == false) {
    123. setControl009();
    124. }
    125. }
    126. }
    127. function setControl015(){
    128. setControls(1, "i0078", "i0069");
    129. setControls(3, "i0078", "i0081", "i0086", "i0091", "i0096");
    130. }
    131. function setControl007(){
    132. if(document.forms[0].i0053) {
    133. setControls(2, "i0053", "i0055A", "i0055B", "i0057A", "i0057B", "i0059A", "i0059B");
    134. check = new Number(document.forms[0].i0053.value);
    135. if(check == 1) {
    136. setControls(1, "i0053", "i0055A", "i0055B", "i0059A", "i0059B");
    137. }
    138. else if(check == 3) {
    139. setControls(3, "i0053", "i0055A", "i0055B", "i0057A", "i0057B");
    140. }
    141. if(document.forms[0].i0055A){
    142. if(document.forms[0].i0055A.disabled == false){
    143. if((document.forms[0].i0055A.checked == false) && (document.forms[0].i0055B.checked == false)){
    144. document.forms[0].i0055A.checked = true;
    145. }
    146. }
    147. }
    148. if(document.forms[0].i0057A){
    149. if(document.forms[0].i0057A.disabled == false){
    150. if((document.forms[0].i0057A.checked == false) && (document.forms[0].i0057B.checked == false)){
    151. document.forms[0].i0057A.checked = true;
    152. }
    153. }
    154. }
    155. if(document.forms[0].i0059A){
    156. if(document.forms[0].i0059A.disabled == false){
    157. if((document.forms[0].i0059A.checked == false) && (document.forms[0].i0059B.checked == false)){
    158. document.forms[0].i0059A.checked = true;
    159. }
    160. }
    161. }
    162. if(document.forms[0].i0053.value == 0){
    163. if(document.forms[0].i0062.value == 6){
    164. setSelectDuplex(document.forms[0]);
    165. } else {
    166. setSelectMagnification();
    167. }
    168. } else {
    169. setSelectDuplex(document.forms[0]);
    170. }
    171. }
    172. }
    173. function validate(e) {
    174. var frm=document.forms[0];
    175. var result=true;
    176. var customResult=true;
    177. var errs=[];
    178. var errsIP=[];
    179. var checkparam=[
    180. [1,1,"1","99",frm.i0014,"Кол-во копий:","i6001"],
    181. [1,1,"25","400",frm.i0063,"Коэффициент масшт.:","i6002"],
    182. [1,1,"1","50",frm.i0081,"Указать ширину рамки:","i6003"]
    183. ];
    184. var customErrSetParam=[
    185. [0,"Указать ширину рамки:","i6003"]
    186. ];
    187. var errorMsg=["Правильно введите следующие позиции:","Правильно введите следующий IP-адрес:"];
    188. if(frm!=null) {
    189. customResult = setInchValidate(frm);
    190. setCustomErrMsg(customResult, customErrSetParam[0], errs, errsIP);
    191. result = comValidate(frm, checkparam, errs, errsIP, errorMsg);
    192. }
    193. if(result==true){
    194. buttonDisabled();
    195. document.forms[0].submit();
    196. }
    197. return result;
    198. }
    199. function setInchValidate(frm) {
    200. if((frm.i0086)&&(frm.i0096)){
    201. if((frm.i0086.disabled==false)&&(frm.i0096.disabled==false)){
    202. if((frm.i0086.value==0)&&(frm.i0096.value==0)){
    203. return false;
    204. }
    205. }
    206. }
    207. return true;
    208. }
    209. function setViewFine(){
    210. setViewFineValue(document.forms[0].i0029.value, document.forms[0].i0031);
    211. setViewFineValue(document.forms[0].i0029.value, document.forms[0].i0033);
    212. setViewFineValue(document.forms[0].i0029.value, document.forms[0].i0035);
    213. }
    214. function setViewFineValue(value, obj){
    215. param = new Number(value);
    216. for(count = 0; count < obj.options.length; count++) {
    217. check = new Number(obj.options[count].value);
    218. if(param == (check - 6)) {
    219. obj.options[count].selected = true;
    220. break;
    221. }
    222. }
    223. }
    224. function changeDensityAdjust(valColor) {
    225. var count;
    226. for(count = 0; count < document.forms[0].i0029.options.length; count++){
    227. var val=document.forms[0].i0029.options[count].value;
    228. if(val == (valColor - 6)){
    229. document.forms[0].i0029.options[count].selected = true;
    230. }
    231. }
    232. }
    233. function setDensityAdjust() {
    234. var valR=document.forms[0].i0031.value;
    235. var valG=document.forms[0].i0033.value;
    236. var valB=document.forms[0].i0035.value;
    237. if((valR==valG) && (valG==valB)){
    238. changeDensityAdjust(valR);
    239. }
    240. }
    241. function setSelectDuplex(frm){
    242. tray0_0 = [
    243. ["Выкл.","2"],
    244. ["2 на 1","3"],
    245. ["4 на 1","4"],
    246. ["Копирование ИД-карточки","255"]];
    247. tray0_1 = [
    248. ["Выкл.","2"],
    249. ["2 на 1","3"],
    250. ["4 на 1","4"]];
    251. tray0_2 = [
    252. ["Выкл.","2"],
    253. ["2 на 1","3"],
    254. ["4 на 1","4"]];
    255. tray0_3 = [
    256. ["Выкл.","2"],
    257. ["2 на 1","3"],
    258. ["4 на 1","4"]];
    259. tray0 = [
    260. ["0",tray0_0],
    261. ["1",tray0_1],
    262. ["2",tray0_2],
    263. ["3",tray0_3]];
    264.  
    265. comSelSelect(tray0, frm.i0053, frm.i0069);
    266. }
    267. function setSelectMagnification(){
    268. if(($IV("i0062",0)==0)&&($IV("i0063",25)==100)) {
    269. tray2_0 = [
    270. ["Выкл.","2"],
    271. ["2 на 1","3"],
    272. ["4 на 1","4"],
    273. ["Копирование ИД-карточки","255"]];
    274. tray2 = [
    275. ["0",tray2_0]];
    276.  
    277. comSelSelect(tray2, $I("i0062"), $I("i0069"));
    278. }else{
    279. tray1_0 = [
    280. ["Выкл.","2"],
    281. ["2 на 1","3"],
    282. ["4 на 1","4"]];
    283. tray1_21 = [
    284. ["Выкл.","2"],
    285. ["2 на 1","3"],
    286. ["4 на 1","4"]];
    287. tray1_11 = [
    288. ["Выкл.","2"],
    289. ["2 на 1","3"],
    290. ["4 на 1","4"]];
    291. tray1_9 = [
    292. ["Выкл.","2"],
    293. ["2 на 1","3"],
    294. ["4 на 1","4"]];
    295. tray1_20 = [
    296. ["Выкл.","2"],
    297. ["2 на 1","3"],
    298. ["4 на 1","4"]];
    299. tray1_8 = [
    300. ["Выкл.","2"],
    301. ["2 на 1","3"],
    302. ["4 на 1","4"]];
    303. tray1_7 = [
    304. ["Выкл.","2"],
    305. ["2 на 1","3"],
    306. ["4 на 1","4"]];
    307. tray1_6 = [
    308. ["Выкл.","2"],
    309. ["2 на 1","3"],
    310. ["4 на 1","4"],
    311. ["Копирование ИД-карточки","255"]];
    312. tray1_5 = [
    313. ["Выкл.","2"],
    314. ["2 на 1","3"],
    315. ["4 на 1","4"]];
    316. tray1_4 = [
    317. ["Выкл.","2"],
    318. ["2 на 1","3"],
    319. ["4 на 1","4"]];
    320. tray1_18 = [
    321. ["Выкл.","2"],
    322. ["2 на 1","3"],
    323. ["4 на 1","4"]];
    324. tray1_3 = [
    325. ["Выкл.","2"],
    326. ["2 на 1","3"],
    327. ["4 на 1","4"]];
    328. tray1_16 = [
    329. ["Выкл.","2"],
    330. ["2 на 1","3"],
    331. ["4 на 1","4"]];
    332. tray1_1 = [
    333. ["Выкл.","2"],
    334. ["2 на 1","3"],
    335. ["4 на 1","4"]];
    336. tray1_15 = [
    337. ["Выкл.","2"],
    338. ["2 на 1","3"],
    339. ["4 на 1","4"]];
    340. tray1 = [
    341. ["0",tray1_0],
    342. ["21",tray1_21],
    343. ["11",tray1_11],
    344. ["9",tray1_9],
    345. ["20",tray1_20],
    346. ["8",tray1_8],
    347. ["7",tray1_7],
    348. ["6",tray1_6],
    349. ["5",tray1_5],
    350. ["4",tray1_4],
    351. ["18",tray1_18],
    352. ["3",tray1_3],
    353. ["16",tray1_16],
    354. ["1",tray1_1],
    355. ["15",tray1_15]];
    356.  
    357. comSelSelect(tray1, $I("i0062"), $I("i0069"));
    358. }
    359. }
    360. function setMagnification(frm){
    361. var trayList = [
    362. [7,2100,2970],
    363. [101,2100,2970]];
    364. var readList = [
    365. [2,2100,2970],
    366. [3,1480,2100],
    367. [7,1820,2570],
    368. [14,1000,1480],
    369. [13,2159,2794],
    370. [12,2159,3556],
    371. [60,1397,2159]];
    372.  
    373. var trayListCnt = trayList.length;
    374. var readListCnt = readList.length;
    375. var tray = 0;
    376. var read = frm.i0071.value;
    377. var numberUp = Number(frm.i0069.value);
    378. var mag = 0;
    379. var magX = 0;
    380. var magY = 0;
    381. var trayX = 0;
    382. var trayY = 0;
    383. var readX = 0;
    384. var readY = 0;
    385. var count;
    386. if((numberUp != 3) && (numberUp != 4)) {
    387. return;
    388. }
    389. if(frm.i2000A.checked) {
    390. tray = frm.i2000A.value;
    391. } else if(frm.i2000B.checked) {
    392. tray = frm.i2000B.value;
    393. } else if(frm.i2000C.checked) {
    394. tray = frm.i2000C.value;
    395. } else {
    396. tray = 0;
    397. }
    398. for(= 0; i < trayListCnt; i++) {
    399. if(tray == trayList[i][0]) {
    400. trayX = trayList[i][1];
    401. trayY = trayList[i][2];
    402. }
    403. }
    404. for(= 0; i < readListCnt; i++) {
    405. if(read == readList[i][0]) {
    406. readX = readList[i][1];
    407. readY = readList[i][2];
    408. }
    409. }
    410. if((readX != 0) && (readY != 0)) {
    411. switch(numberUp){
    412. case 3:
    413. if(trayX > trayY){
    414. magX = (trayX * 100) / (readX * 2);
    415. magY = (trayY * 100) / readY;
    416. }else{
    417. magX = (trayY * 100) / (readX * 2);
    418. magY = (trayX * 100) / readY;
    419. }
    420. break;
    421. case 4:
    422. if(((trayX > trayY) && (readX > readY)) || ((trayX < trayY) && (readX < readY))) {
    423. magX = (trayX * 100) / (readX * 2);
    424. magY = (trayY * 100) / (readY * 2);
    425. }else{
    426. magX = (trayY * 100) / (readX * 2);
    427. magY = (trayX * 100) / (readY * 2);
    428. }
    429. break;
    430. default:
    431. break;
    432. }
    433. }
    434. mag = Math.min(magX, magY);
    435. mag = Math.floor(mag);
    436. if(mag < 25){
    437. mag = 25;
    438. }
    439. if(mag > 400){
    440. mag = 400;
    441. }
    442. for(count = 0; count < frm.i0062.options.length; count++){
    443. var val=frm.i0062.options[count].value;
    444. if(val == 0){
    445. frm.i0062.options[count].selected = true;
    446. setControl009();
    447. frm.i0063.value = mag;
    448. break;
    449. }
    450. }
    451. setSelectMagnification();
    452. }
    453. function addEvent() {
    454. var obj = document.getElementById("i0063");
    455. if(obj){
    456. if(obj.attachEvent){
    457. obj.attachEvent("onchange",setControl009);
    458. }else if(obj.addEventListener){
    459. obj.addEventListener("change",setControl009,false);
    460. }
    461. }
    462. }
    463. function initControls(e){
    464. setControl001();
    465. setControl002();
    466. setControl003();
    467. setControl004();
    468. setControl009();
    469. setControl011();
    470. setControl015();
    471. setControl007();
    472. addEvent();
    473. registEvent($I("submitButton"),"click",validate);
    474. }
    475. registEvent(window,"load",initControls);
    476. // -->
    477. </script>
    478. <title>Удаленный ИПИзменить настройки копирования:imageRUNNER1133 series:imageRUNNER1133 series</title>
    479. </head>
    480. <body>
    481. <div id="container">
    482. <div id="ruiCommons">
    483. <div class="Wrapper">
    484. <div id="commonBranding">
    485. <h1 id="deviceLogo">
    486. [url="/portal_top.html"]imageRUNNER</span>[/url]
    487. </h1>
    488. <p id="deviceType">
    489. <span id="deviceName">imageRUNNER1133 series / imageRUNNER1133 series / </span>
    490. </p>
    491. </div>
    492. <div id="commonTools">
    493. <fieldset id="moveTools">
    494. <p>
    495. [url="/portal_top.html"]К порталу</span>[/url]
    496. </p>
    497. </fieldset>
    498. <fieldset id="authTools">
    499. <p id="loginUserData">
    500. <span class="Supplement"></span>
    501. <span id="userName"></span>
    502. </p>
    503. <p>
    504. [url="/logout.cgi"]Выход из системы</span>[/url]
    505. </p>
    506. </fieldset>
    507. </div>
    508. </div>
    509. <hr />
    510. </div>
    511. <div id="applications">
    512. <div id="applicationBranding">
    513. <div class="Wrapper">
    514. <h1 id="applicationLogo">
    515. <img src="/media/app_icon_default.png" alt="Параметры/Регистрация" title="Параметры/Регистрация" />
    516. <span class="BrandingName">Параметры/Регистрация</span></h1>
    517. <div id="appTools">
    518. <table>
    519. <tr>
    520. <td>[url="mailto:"]Отправить эл. почтой администратору системы</span>[/url]</td>
    521. </tr>
    522. </table>
    523. </div>
    524. </div>
    525. </div>
    526. <hr />
    527. <div id="applicationContents">
    528. <div class="Wrapper">
    529. <div id="contentsWrapper">
    530. <div id="contents">
    531. <div id="navTopicPath">
    532. [url="/f_copy.html"]Параметры/Регистрация: Настройки функций: Настройки копирования[/url] > Изменить настройки копирования
    533. </div>
    534. <div id="contentHeading">
    535. <h2 class="PageName">Изменить настройки копирования</h2>
    536. <div id="contentHeadingTools">
    537. </div>
    538. </div>
    539. <div id="contentInformation">
    540. Измените следующие настройки.
    541. </div>
    542. <form name="fCopyEdit" id="0" action="/cgi/f_copy_edit.cgi"  method="post" onsubmit="return false;">
    543.  
    544. <input type="hidden" name="iToken" id="iToken" value="3553590444" />
    545.  
    546. <div class="ContentOperation">
    547. <fieldset>
    548. <input type="button" id="submitButton" class="ButtonEnable" value="OK" />
    549. <input type="button" class="ButtonEnable" value="Отмена" onclick="document.location='/f_copy.html'"/>
    550. </fieldset>
    551. </div>
    552. <div id="" class="ContentModuleEditable">
    553. <div class="ModuleHeading">
    554. <h4>Настройки копирования</h4>
    555. </div>
    556. <div id="" class="ModuleElement">
    557. <table class="PropertyListComponent" rules="groups">
    558. <tbody>
    559. <tr>
    560. <th>Кол-во копий:<span class="Vali_part" id="i6001">Ошибка!</span></th>
    561. <td><input type="text" name="i0014" id="i0014" class="Size_figure" value="35" maxlength="2" onfocus="" autocomplete="off" />
    562.  Копий (1-99)</td>
    563. </tr>
    564. </tbody>
    565. <tbody>
    566. <tr>
    567. <th>Плотность:</th>
    568. <td><select name="i0018" id="i0018" onchange="">
    569. <option value="1">-4</option>
    570. <option value="2">-3</option>
    571. <option value="3">-2</option>
    572. <option value="4">-1</option>
    573. <option value="5" selected='selected'>0</option>
    574. <option value="6">1</option>
    575. <option value="7">2</option>
    576. <option value="8">3</option>
    577. <option value="9">4</option>
    578. </select>
    579. </td>
    580. </tr>
    581. <!--
    582. <tr class="Sub">
    583. <th colspan="2"></th>
    584. </tr>
    585. -->
    586.  
    587. <tr class="Sub">
    588. <th>Фон:</th>
    589. <td><input type="radio" name="i0024" id="i0024A" value="4" onclick="setControl002()" /><label for="i0024A">Авто</label><br />
    590. <input type="radio" name="i0024" id="i0024B" value="2" checked='checked' onclick="setControl003()" /><label for="i0024B">Настройка:</label><br />
    591. <select name="i0025" id="i0025" onchange="">
    592. <option value="-6">-6</option>
    593. <option value="-5">-5</option>
    594. <option value="-4">-4</option>
    595. <option value="-3">-3</option>
    596. <option value="-2">-2</option>
    597. <option value="-1">-1</option>
    598. <option value="0" selected='selected'>0</option>
    599. <option value="1">1</option>
    600. <option value="2">2</option>
    601. </select>
    602. </td>
    603. </tr>
    604.  
    605. <!--
    606. <tr class="Sub2">
    607. <th></th>
    608. <td></td>
    609. </tr>
    610. <tr class="Sub3">
    611. <th></th>
    612. <td></td>
    613. </tr>
    614. <tr class="Sub3">
    615. <th></th>
    616. <td></td>
    617. </tr>
    618. <tr class="Sub3">
    619. <th></th>
    620. <td></td>
    621. </tr>
    622. <tr class="Sub">
    623. <th colspan="2"></th>
    624. </tr>
    625. <tr class="Sub2">
    626. <th></th>
    627. <td></td>
    628. </tr>
    629. <tr class="Sub2">
    630. <th></th>
    631. <td></td>
    632. </tr>
    633. <tr class="Sub2">
    634. <th></th>
    635. <td></td>
    636. </tr>
    637. <tr class="Sub2">
    638. <th></th>
    639. <td></td>
    640. </tr>
    641. -->
    642. </tbody>
    643. <tbody>
    644. <tr>
    645. <th>Тип оригинала:</th>
    646. <td><select name="i0047" id="i0047" onchange="setControl004()">
    647. <option value="1">Текст</option>
    648. <option value="4" selected='selected'>Текст/Фото</option>
    649. <option value="18">Текст/Фото (Качество)</option>
    650. <option value="3">Фото</option>
    651. </select>
    652. </td>
    653. </tr>
    654. <tr class="Sub">
    655. <th>Настройка уровня:</th>
    656. <td>Приоритет текста<br /><input type="radio" name="i0050" id="i0050A" value="1" onclick="" /><label for="i0050A">4</label><br />
    657. <input type="radio" name="i0050" id="i0050B" value="2" onclick="" /><label for="i0050B">3</label><br />
    658. <input type="radio" name="i0050" id="i0050C" value="3" onclick="" /><label for="i0050C">2</label><br />
    659. <input type="radio" name="i0050" id="i0050D" value="4" onclick="" /><label for="i0050D">1</label><br />
    660. <input type="radio" name="i0050" id="i0050E" value="5" checked='checked' onclick="" /><label for="i0050E">0</label><br />
    661. <input type="radio" name="i0050" id="i0050F" value="6" onclick="" /><label for="i0050F">1</label><br />
    662. <input type="radio" name="i0050" id="i0050G" value="7" onclick="" /><label for="i0050G">2</label><br />
    663. <input type="radio" name="i0050" id="i0050H" value="8" onclick="" /><label for="i0050H">3</label><br />
    664. <input type="radio" name="i0050" id="i0050I" value="9" onclick="" /><label for="i0050I">4</label><br />
    665. Приоритет фото</td>
    666. </tr>
    667. </tbody>
    668.  
    669. <tbody>
    670. <tr>
    671. <th>2-сторонняя:</th>
    672. <td><select name="i0053" id="i0053" onchange="setControl007()">
    673. <option value="0" selected='selected'>Выкл.</option>
    674. <option value="1">1->2 стороны</option>
    675. </select>
    676. </td>
    677. </tr>
    678. <tr class="Sub">
    679. <th>Ориентация оригинала:</th>
    680. <td><input type="radio" name="i0055" id="i0055A" value="6" onclick="" /><label for="i0055A">Книжная</label><br />
    681. <input type="radio" name="i0055" id="i0055B" value="7" onclick="" /><label for="i0055B">Альбомная</label><br />
    682. </td>
    683. </tr>
    684. <!--
    685. <tr class="Sub">
    686. <th></th>
    687. <td></td>
    688. </tr>
    689. -->
    690.  
    691. <tr class="Sub">
    692. <th>Формат конечной обработки:</th>
    693. <td><input type="radio" name="i0059" id="i0059A" value="4" onclick="" /><label for="i0059A">Тип книги</label><br />
    694. <input type="radio" name="i0059" id="i0059B" value="3" onclick="" /><label for="i0059B">Тип календаря</label><br />
    695. </td>
    696. </tr>
    697.  
    698. </tbody>
    699.  
    700. <tbody>
    701. <tr>
    702. <th>Коэффициент масшт.:<span class="Vali_part" id="i6002">Ошибка!</span></th>
    703. <td><select name="i0062" id="i0062" onchange="setControl009()">
    704. <option value="0">Польз. коэфф.</option>
    705. <option value="21">400% максимум</option>
    706. <option value="11">200%</option>
    707. <option value="9">141% A5->A4</option>
    708. <option value="6" selected='selected'>100% 1:1</option>
    709. <option value="3">70% A4->A5</option>
    710. <option value="1">50%</option>
    711. <option value="15">25% минимум</option>
    712. </select>
    713. <input type="text" name="i0063" id="i0063" class="Size_figure" value="100" maxlength="3" onfocus="" autocomplete="off" />
    714.  % (25-400)</td>
    715. </tr>
    716. </tbody>
    717. <tbody>
    718. <tr>
    719. <th>Источник бумаги:</th>
    720. <td><input type="radio" name="i2000" id="i2000A" value="7" onclick="setMagnification(document.forms[0])" /><label for="i2000A">Универсальный лоток</label><br />
    721. <input type="radio" name="i2000" id="i2000B" value="101" checked='checked' onclick="setMagnification(document.forms[0])" /><label for="i2000B">Кассета 1</label><br />
    722. </td>
    723. </tr>
    724. </tbody>
    725. <tbody>
    726. <tr>
    727. <th>N на 1:</th>
    728. <td><select name="i0069" id="i0069" onchange="setControl010()">
    729. <option value="2" selected='selected'>Выкл.</option>
    730. <option value="3">2 на 1</option>
    731. <option value="4">4 на 1</option>
    732. <option value="255">Копирование ИД-карточки</option>
    733. </select>
    734. </td>
    735. </tr>
    736. <tr class="Sub">
    737. <th>Формат сканирования:</th>
    738. <td><select name="i0071" id="i0071" onchange="setMagnification(document.forms[0])">
    739. <option value="2" selected='selected'>A4</option>
    740. <option value="3">A5</option>
    741. </select>
    742. </td>
    743. </tr>
    744. <tr class="Sub">
    745. <th>Выбор макета:</th>
    746. <td><input type="radio" name="i0002" id="i0002A" value="52" checked='checked' /><img src="/media/2in1_layout1.gif" /><label for="i0002A">2 на 1 (1)</label><br />
    747. <input type="radio" name="i0002" id="i0002B" value="53" /><img src="/media/2in1_layout2.gif" /><label for="i0002B">2 на 1 (2)</label><br />
    748. <input type="radio" name="i0002" id="i0002C" value="66" /><img src="/media/4in1_layout1.gif" /><label for="i0002C">4 на 1 (1)</label><br />
    749. <input type="radio" name="i0002" id="i0002D" value="67" /><img src="/media/4in1_layout2.gif" /><label for="i0002D">4 на 1 (2)</label><br />
    750. <input type="radio" name="i0002" id="i0002E" value="68" /><img src="/media/4in1_layout3.gif" /><label for="i0002E">4 на 1 (3)</label><br />
    751. <input type="radio" name="i0002" id="i0002F" value="69" /><img src="/media/4in1_layout4.gif" /><label for="i0002F">4 на 1 (4)</label><br />
    752. </td>
    753. </tr>
    754. </tbody>
    755. <tbody>
    756. <tr>
    757. <th>Сортировка:</th>
    758. <td><select name="i0076" id="i0076" onchange="">
    759. <option value="8" selected='selected'>Выкл.</option>
    760. <option value="11">Вкл.</option>
    761. </select>
    762. </td>
    763. </tr>
    764. </tbody>
    765. <tbody>
    766. <tr>
    767. <th>Стирание рамки:</th>
    768. <td><select name="i0078" id="i0078" onchange="setControl015()">
    769. <option value="1" selected='selected'>Выкл.</option>
    770. <option value="3">Вкл.</option>
    771. </select>
    772. </td>
    773. </tr>
    774. <tr class="Sub">
    775. <th>Указать ширину рамки:<span class="Vali_part" id="i6003">Ошибка!</span></th>
    776.  
    777. <td><input type="text" name="i0081" id="i0081" class="Size_figure" value="4" maxlength="2" onfocus="" autocomplete="off" />
    778.  мм (1-50)</td>
    779.  
    780. <!--
    781. <td>    </td>
    782. -->
    783. </tr>
    784. <tr class="Sub">
    785. <th>Формат сканирования:</th>
    786. <td><select name="i0091" id="i0091" onchange="">
    787. <option value="2" selected='selected'>A4</option>
    788. <option value="3">A5</option>
    789. </select>
    790. </td>
    791. </tr>
    792. </tbody>
    793. <tbody>
    794. <tr>
    795. <th>Резкость:</th>
    796. <td><select name="i0093" id="i0093" onchange="">
    797. <option value="1">-3</option>
    798. <option value="2">-2</option>
    799. <option value="3">-1</option>
    800. <option value="4" selected='selected'>0</option>
    801. <option value="5">1</option>
    802. <option value="6">2</option>
    803. <option value="7">3</option>
    804. </select>
    805. </td>
    806. </tr>
    807. </tbody>
    808. </table>
    809. </div>
    810. </div>
    811. </form>
    812. <div id="tmpFooter">
    813. <hr />
    814. <div class="GotoTop">
    815. [url="javascript:scrollTo(0,0);"]<img src="/media/ba_ptp.gif" alt="В начало страницы" title="В начало страницы" />[/url]
    816. </div>
    817. </div>
    818. </div>
    819. </div>
    820. <hr />
    821. <div id="navigationWrapper">
    822. <div id="navigation">
    823. <ul class="Main">
    824. <li class="MainItem">
    825. <span class="GroupTitle">Настройки</span>
    826. <ul class="Sub">
    827. <li class="Standby">[url="/p_paper.html"]Установки бумаги[/url]</li>
    828. <li class="Standby">[url="/p_preference.html"]Рег. громкости звука / Настройки отображения[/url]</li>
    829. <li class="Standby">[url="/p_timer.html"]Настройки таймера[/url]</li>
    830. </ul>
    831. </li>
    832. </ul>
    833. <ul class="Main">
    834. <li class="MainItem">
    835. <span class="GroupTitle">Настройки функций</span>
    836. <ul class="Sub">
    837. <li class="Standby">[url="/f_common.html"]Общие настройки[/url]</li>
    838. <li class="Selected">[url="/f_copy.html"]Настройки копирования[/url]</li>
    839. <!--
    840. <li class=""><a href=""></a></li>
    841. -->
    842.  
    843. <li class="Standby">[url="/f_scan.html"]Настройки сканирования[/url]</li>
    844.  
    845.  
    846. <li class="Standby">[url="/f_external_interface.html"]Настройки прямой печати из устр-ва USB[/url]</li>
    847.  
    848.  
    849. <li class="Standby">[url="/f_printer.html"]Настройки принтера[/url]</li>
    850.  
    851. <!--
    852. <li class=""><a href=""></a></li>
    853. -->
    854. </ul>
    855. </li>
    856. </ul>
    857. <ul class="Main">
    858. <li class="MainItem">
    859. <span class="GroupTitle">Настройки системы</span>
    860. <ul class="Sub">
    861. <li class="Standby">[url="/m_system.html"]Настройки системы[/url]</li>
    862. <!--
    863.  
    864. <li class=""><a href=""></a></li>
    865.  
    866. <li class=""><a href=""></a></li>
    867. <li class=""><a href=""></a></li>
    868.  
    869. <li class=""><a href=""></a></li>
    870.  
    871. <li class=""><a href=""></a></li>
    872. <li class=""><a href=""></a></li>
    873. -->
    874. </ul>
    875. </li>
    876. </ul>
    877. </div>
    878. </div>
    879. </div>
    880. </div>
    881. <hr />
    882. <div id="applicationInfo">
    883. <address class="SiteInforLegal">Copyright CANON INC. 2011 All Rights Reserved</address>
    884. </div>
    885. </div>
    886. </div>
    887. </body>
    888. </html>
    В чем здесь может быть дело, почему в первом случае работает, а во втором случае не работает? Есть ли способы узнать, чем отличается запрос CURL и запрос браузера, чтобы понять, что неправильно в запросе CURL?

    PHP, JavaScript, SQL и другой код пишите внутри тегов
    Код ( (Unknown Language)):
    1. [b]php][/b]Тут код[b][/[/b][b]code][/b][/color]
     
  2. denis01

    denis01 Суперстар
    Команда форума Модератор

    С нами с:
    9 дек 2014
    Сообщения:
    12.227
    Симпатии:
    1.714
    Адрес:
    Молдова, г.Кишинёв
    через Fiddler посмотри какие запросы идут от браузера к веб серверу, анализируй их и повтори через cURL
     
  3. Макс1

    Макс1 Активный пользователь

    С нами с:
    11 сен 2015
    Сообщения:
    6
    Симпатии:
    0
    Проблема была в том, что надо отправлять все данные формы, а также случайное число iToken, которое определяю при чтении страницы. Теперь работает.