@@ -793,11 +793,9 @@ private function _request($data, $replace = array(), $attribs = array()) {
793
793
$ xml = $ data ;
794
794
}
795
795
796
- $ fields = array (
797
- "jsessionid " => isset ($ this ->_jsessionid ) ? $ this ->_jsessionid : '' ,
798
- "xml " => $ xml ,
799
- );
800
- $ response = $ this ->_httpPost ($ fields );
796
+ $ jsessionid = isset ($ this ->_jsessionid ) ? $ this ->_jsessionid : '' ;
797
+
798
+ $ response = $ this ->_httpPost ($ jsessionid , $ xml );
801
799
if ($ response ) {
802
800
$ arr = \Silverpop \Util \xml2array ($ response );
803
801
if (isset ($ arr ["Envelope " ]["Body " ]["RESULT " ]["SUCCESS " ])) {
@@ -814,19 +812,19 @@ private function _request($data, $replace = array(), $attribs = array()) {
814
812
* Private method: post the request to the url
815
813
*
816
814
*/
817
- private function _httpPost ($ fields ) {
818
- $ fields_string = http_build_query ($ fields );
815
+ private function _httpPost ($ jsessionid , $ xml ) {
819
816
//open connection
820
817
$ ch = curl_init ();
821
818
822
819
//set the url, number of POST vars, POST data
823
- curl_setopt ($ ch ,CURLOPT_HTTPHEADER , array ('Expect: ' ));
824
- curl_setopt ($ ch ,CURLOPT_URL ,$ this ->_getFullUrl ());
825
- curl_setopt ($ ch ,CURLOPT_POST ,count ($ fields ));
826
- curl_setopt ($ ch ,CURLOPT_POSTFIELDS ,$ fields_string );
820
+ curl_setopt ($ ch ,CURLOPT_HTTPHEADER , array ('Expect: ' ));
821
+ curl_setopt ($ ch ,CURLOPT_URL ,$ this ->_getFullUrl ().'?jsessionid= ' .$ jsessionid );
822
+ curl_setopt ($ ch ,CURLOPT_POSTFIELDS ,$ xml );
827
823
curl_setopt ($ ch ,CURLOPT_RETURNTRANSFER ,true );
828
- curl_setopt ($ ch ,CURLOPT_HTTPHEADER ,array (
829
- "Content-Type: application/x-www-form-urlencoded; charset=utf-8 " ));
824
+ curl_setopt ($ ch ,CURLOPT_HTTPHEADER , array (
825
+ 'Content-Type: text/xml;charset=UTF-8 ' ,
826
+ 'Content-Length: ' .strlen ($ xml )
827
+ ));
830
828
831
829
//execute post
832
830
$ result = curl_exec ($ ch );
0 commit comments