newbie14 0 Posting Pro

I am working on a small as2 message passing. Below are my codes. First is the host which will send the header and data to the server. Then the server is suppose to form a reply in this format http://www.edidev.net/edidev-ca/help/Using/Using_AS2/Using_MDN/MDNRequestFromAs2SubjMsg.htm

<?php

  $header = "HTTP/1.0\r\n";

$header.= "CONNECTION: Keep-Alive \r\n\r\n"; 
  // Here is the data we will be sending to the service
  $some_data = array(
    'message' =>'Test1', 
    'name' => 'Chad'
  );  

  $curl = curl_init();
  // You can also set the URL you want to communicate with by doing this:
  // $curl = curl_init('http://localhost/echoservice');

  // We POST the data
  curl_setopt($curl, CURLOPT_POST, 1);
  // Set the url path we want to call
  curl_setopt($curl, CURLOPT_URL, 'http://localhost/pro1/helloservice.php'); 

  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'AS2-FROM: TEst1',
    'X-BLUECOAT-VIA: test1',
    'DISPOSITION-NOTIFICATION-TO: TEst1',
    'MESSAGE-ID: 15610.1493.14155.*****.com',
    'AS2-TO: Test2',
    'CONTENT-LENGTH:5',
    'CONTENT-TYPE: application/edifact',
    'CONTENT-TYPE: application/edifact',
    'HOST: localhost:8080'
    ));


  // Make it so the data coming back is put into a string
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  // Insert the data
  curl_setopt($curl, CURLOPT_POSTFIELDS, $some_data);

  // You can also bunch the above commands into an array if you choose using: curl_setopt_array

  // Send the request
  $result = curl_exec($curl);
  // Free up the resources $curl is using
  $info = curl_getinfo($curl);  
  echo 'content type: ' . $info['content_type'] . '<br>';
  //echo 'http code: ' . $info['http_code'] . '<br>';



  curl_close($curl);

  echo $result;

?>

Below is the codes on the server.

<?php
  //echo 'Your message was: ' . $_REQUEST["message"] . ' and your name is: ' . $_REQUEST["name"];
$headers = apache_request_headers();

foreach ($headers as $header => $value) {
    echo "$header: $value <br />\n";
}
?>

Below is the result which I get from the server as the response

content type: text/html; charset=iso-8859-1<br><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>413 Request Entity Too Large</title>
</head><body>
<h1>Request Entity Too Large</h1>
The requested resource<br />/pro1/helloservice.php<br />
does not allow request data with POST requests, or the amount of data provided in
the request exceeds the capacity limit.
</body></html>
Accept: */* <br />
AS2-FROM: TEst1 <br />
X-BLUECOAT-VIA: test1 <br />
DISPOSITION-NOTIFICATION-TO: TEst1 <br />
MESSAGE-ID: 15610.1493.14155.*****.com <br />
AS2-TO: Test2 <br />
CONTENT-LENGTH: 5, 244 <br />
HOST: localhost:8080 <br />
Expect: 100-continue <br />
CONTENT-TYPE: application/edifact; boundary=----------------------------f7a2c0404c39 <br />

I have 2 issue is that it gives me 413 when my data is so small in size and secondly the response I want to make it multiple part which is where I am stuck as I dont know how to add on the boundaries?