@@ -664,11 +664,9 @@ private function _request($data, $replace = array(), $attribs = array()) {
664
664
$ xml = $ data ;
665
665
}
666
666
667
- $ fields = array (
668
- "jsessionid " => isset ($ this ->_jsessionid ) ? $ this ->_jsessionid : '' ,
669
- "xml " => $ xml ,
670
- );
671
- $ response = $ this ->_httpPost ($ fields );
667
+ $ jsessionid = isset ($ this ->_jsessionid ) ? $ this ->_jsessionid : '' ;
668
+
669
+ $ response = $ this ->_httpPost ($ jsessionid , $ xml );
672
670
if ($ response ) {
673
671
$ arr = \Silverpop \Util \xml2array ($ response );
674
672
if (isset ($ arr ["Envelope " ]["Body " ]["RESULT " ]["SUCCESS " ])) {
@@ -685,16 +683,18 @@ private function _request($data, $replace = array(), $attribs = array()) {
685
683
* Private method: post the request to the url
686
684
*
687
685
*/
688
- private function _httpPost ($ fields ) {
689
- $ fields_string = http_build_query ($ fields );
686
+ private function _httpPost ($ jsessionid , $ xml ) {
690
687
//open connection
691
688
$ ch = curl_init ();
692
689
693
690
//set the url, number of POST vars, POST data
694
- curl_setopt ($ ch ,CURLOPT_URL ,$ this ->_getFullUrl ());
695
- curl_setopt ($ ch ,CURLOPT_POST ,count ($ fields ));
696
- curl_setopt ($ ch ,CURLOPT_POSTFIELDS ,$ fields_string );
691
+ curl_setopt ($ ch ,CURLOPT_URL ,$ this ->_getFullUrl ().'?jsessionid= ' .$ jsessionid );
692
+ curl_setopt ($ ch ,CURLOPT_POSTFIELDS ,$ xml );
697
693
curl_setopt ($ ch ,CURLOPT_RETURNTRANSFER ,true );
694
+ curl_setopt ($ ch ,CURLOPT_HTTPHEADER , array (
695
+ 'Content-Type: text/xml;charset=UTF-8 ' ,
696
+ 'Content-Length: ' .strlen ($ xml )
697
+ ));
698
698
699
699
//execute post
700
700
$ result = curl_exec ($ ch );
0 commit comments