Changeset f57102f in TibisayFirmaWeb


Ignore:
Timestamp:
Sep 30, 2015, 9:51:45 AM (9 years ago)
Author:
Pedro Buitrago <pbuitrago@…>
Branches:
master
Children:
1076148
Parents:
cc1b143
Message:

se modifico direcciones url del archivo firma_adjuntos.js donde se llama a las funciones php y se modifico la función sendSing para que imprima la direccion para descargar el archivo firmado en bdoc

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • firma_adjuntos.js

    rcc1b143 rf57102f  
    8989      //console.log(data);
    9090         $.ajax({
    91              url: "sendFile.php",
     91             url: "./plugins/firma_adjuntos/sendFile.php",
    9292             type: "POST",
    9393             data: data,
     
    114114             //Enviar el identificador del documento y obterner el hash
    115115             $.ajax({
    116                  url:"sendCert.php",
     116                 url:"./plugins/firma_adjuntos/sendCert.php",
    117117                 type: 'POST',
    118118                 data: {"parameters":parameters,'format':format }
     
    135135                    var singvalue = signature.hex;
    136136                    $.ajax({
    137                         url:"sendSing.php",
     137                        url:"./plugins/firma_adjuntos/sendSing.php",
    138138                        type: 'POST',
    139139                        data: {"signature":singvalue,'format':format}
     
    178178
    179179          $.ajax({
    180              url: "sendFile.php",
     180             url: "./plugins/firma_adjuntos/sendFile.php",
    181181             type: "POST",
    182182             data: formData,
     
    205205             //Enviar el identificador del documento y obterner el hash
    206206             $.ajax({
    207                  url:"sendCert.php",
     207                 url:"./plugins/firma_adjuntos/sendCert.php",
    208208                 type: 'POST',
    209209                 data: {"parameters":parameters,'format':format}
     
    223223                    var singvalue = signature.hex;
    224224                    $.ajax({
    225                         url:"sendSing.php",
     225                        url:"./plugins/firma_adjuntos/sendSing.php",
    226226                        type: 'POST',
    227227                        data: {"signature":singvalue, "containerId":containerId, 'format':format}
  • sendSing.php

    rcc1b143 rf57102f  
    55   //Sección del pdf :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    66
    7    if (isset($_POST['signature']) && $_POST['format'] == 'pdf') {
     7  if(isset($_POST['signature']) && $_POST['format'] == 'pdf') {
    88     
    9        //$url = "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas";
    10        $url = "https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs/resenas";
    11        $fields = array(
     9      $url = "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas";
     10      //$url = "https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs/resenas";
     11      $fields = array(
    1212         'signature' => $signatureData,
    1313         'containerId' => ""
    1414      );
    15      //print_r(json_encode($fields));
    16      $fieldsJson = json_encode($fields);
     15      //print_r(json_encode($fields));
     16      $fieldsJson = json_encode($fields);
     17 
     18      $headers = array(
     19          'Content-Type: application/json',
     20          'Authorization: Basic '. base64_encode("admin:admin"),
     21          'Content-Length:'.strlen($fieldsJson)
     22      );
    1723
    18  
    19        $headers = array(
    20         'Content-Type: application/json',
    21         'Authorization: Basic '. base64_encode("admin:admin"), // <---
    22         'Content-Length:'.strlen($signatureData)
    23      );
     24      if ($ch = curl_init($url)) {
     25          curl_setopt($ch, CURLOPT_TIMEOUT, 5);
     26          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     27          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
     28          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     29          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
     30          curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     31          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     32          //curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                 
     33          //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     34          //curl_setopt($ch, CURLOPT_POST, true); // enable posting
    2435
    25        if ($ch = curl_init($url)) {
    26         curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    27         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    28         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    29         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    30         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    31         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    32         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    33       //curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                 
    34       //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    35         //curl_setopt($ch, CURLOPT_POST, true); // enable posting
     36          curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsJson);
     37          //curl_setopt($ch, CURLOPT_POSTFIELDS, $parameterData);
    3638
    37         curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsJson);
    38       //curl_setopt($ch, CURLOPT_POSTFIELDS, $parameterData);
     39          $data = curl_exec($ch);
     40          $response = curl_getinfo($ch);
    3941
    40      $data = curl_exec($ch);
    41      $response = curl_getinfo($ch);
     42          //print('curl getInfo: \n\t');
     43          print_r($response);
    4244
    43      //print('curl getInfo: \n\t');
    44      //print_r($response);
     45          if ($data == false) {
     46              echo 'Warning : ' . curl_error($ch);
     47              curl_close($ch);
     48              print_r($data);
     49           }
     50          else {
     51              echo'Exit';
     52              curl_close($ch);
     53              print_r($data);
     54          }
     55      }
    4556
    46     if ($data == false) {
    47       //echo 'Warning : ' . curl_error($ch);
    48       curl_close($ch);
    49       //print_r($data);
    50     }
    51     else {
    52       //echo'Exit';
    53       curl_close($ch);
    54       print_r($data);
    55     }
    56   }
    57 
    58 
    59    }
     57}
    6058
    6159  //Sección del bdoc :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
    9391
    9492     $data = curl_exec($ch);
     93     $datajson = json_decode($data,true);
     94     $idFile = $datajson['signedFileId'];
     95     $pathFile = 'https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/'. $idFile;
    9596     $response = curl_getinfo($ch);
    9697
     
    106107      curl_close($ch);
    107108      //echo'Exit';
    108       print_r($data);
     109      print_r($pathFile);
    109110    }
    110111  }
Note: See TracChangeset for help on using the changeset viewer.