0

I have the following peice of PHP code, using to access a POST method REST web service :

$PJS = isset($_REQUEST['arrayFile']) ? $_REQUEST['arrayFile'] : array();
    foreach ($PJS as $PJ) {
        $ext    = explode('/', $PJ['type'])[1];
        $storeAttachmentResourceParams = array(
        'encodedFile'   => $PJ['content'],
        'resId'         => $resId,
        'data'          => json_encode(
                                array(
                                    array('column' => 'title', 'value' => 'PJ', 'type' => 'string'),
                                    array('column' => 'attachment_type', 'value' => 'simple_attachment', 'type' => 'string'),
                                    array('column' => 'status', 'value' => 'A_TRA', 'type' => 'string'),
                                  )
                            ),
        'collId'        => 'letterbox_coll',
        'collIdMaster'  => 'letterbox_coll',
        'table'         => 'res_attachments',
        'fileFormat'    => $ext
    );
        $storeAttachmentResource = Requests::post($cfg['url'] . '/attachments', array(), $storeAttachmentResourceParams, $options);

This piece of PHP code is call under a wordpress PHP snippet like the following :

$url = 'https://XXXX.XXX.fr/interface/iface.php';
$options = array(
     'http' => array(
     'header' => "",
     'proxy'     => "tcp://192.168.X.X:3128",
     'timeout' => 100,
     'method' => 'POST',
     'content' => http_build_query($data)
     )
);
$context = stream_context_create($options);
$return = file_get_contents($url, false, $context);
$returnIface = json_decode($return);

I modify my Apache2.conf like the following to add the LimitRequestLine:

AccessFileName .htaccess
LimitRequestLine 10000000
LimitRequestFieldSize 10000000

Restarted the Apache2 server but still have the following error in my browser :

 Request-URI Too Long

The requested URL's length exceeds the capacity
limit for this server.



Apache/2.4.25 (Debian) Server at infosv47.sartrouville.lan Port 80


"
  ["headers"]=>
  object(Requests_Response_Headers)#23 (1) {
    ["data":protected]=>
    array(4) {
      ["date"]=>
      array(1) {
        [0]=>
        string(29) "Fri, 06 Jul 2018 13:03:25 GMT"
      }
      ["server"]=>
      array(1) {
        [0]=>
        string(22) "Apache/2.4.25 (Debian)"
      }
      ["content-length"]=>
      array(1) {
        [0]=>
        string(3) "339"
      }
      ["content-type"]=>
      array(1) {
        [0]=>
        string(29) "text/html; charset=iso-8859-1"
      }
    }
  }
  ["status_code"]=>
  int(414)
  ["protocol_version"]=>
  float(1.1)
  ["success"]=>
  bool(false)
  ["redirects"]=>
  int(0)
  ["url"]=>
  string(46) "http://10.10.XX.XX/cs_maarch/rest/attachments"
  ["history"]=>
  array(0) {
  }
  ["cookies"]=>
  object(Requests_Cookie_Jar)#20 (1) {
    ["cookies":protected]=>
    array(0) {
    }
  }
}

It's under a Debian 9

Nathan30
  • 689
  • 2
  • 8
  • 29

0 Answers0