WebPHP is called by Http Client POST in CakePHP 3.6.7, but the returned body part is html format data. CakePHP2.5.2 was processed without any problems, but when upgrading to CakePHP3.6.7, 406 is returned.
In CakePHP 3.6.7, can the body part receive the XML/JSON format data?

  • Answer # 1

    After a lot of trial and error, changing $header as follows worked.
    $header = ['headers'=>['Content-Type'=>'application/xml;charset = UTF-8']];
    I don't know if this is the correct answer, but for now I'm going to look at it.

  • Answer # 2

    I think you can receive HTML. It seems that 406 has been returned has failed before that.

    Since the code is not posted, I guess ...
    If406 Not Acceptableis returned, there may be a problem with the POST request header.

    Did you settext/htmlto type when making a request?
    Refer to the manual for how to specify type.