10000 Build custom multipart body · codezninja/codebird-php@aa59f91 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa59f91

Browse files
committed
Build custom multipart body
1 parent 422aa88 commit aa59f91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/codebird.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,11 @@ protected function _buildMultipart($method, $params)
758758
}
759759
}
760760

761+
/*
761762
$multipart_request .=
762763
"\r\nContent-Transfer-Encoding: base64";
763764
$value = base64_encode($value);
765+
*/
764766
}
765767

766768
$multipart_request .=
@@ -846,17 +848,15 @@ protected function _callApi($httpmethod, $method, $method_template, $params = ar
846848
}
847849
if ($multipart) {
848850
$first_newline = strpos($params, "\r\n");
849-
$multipart_boundary = substr($params, 2, $first_newline);
851+
$multipart_boundary = substr($params, 2, $first_newline - 2);
852+
$request_headers[] = 'Content-Length: ' . strlen($params);
850853
$request_headers[] = 'Content-Type: multipart/form-data; boundary='
851854
. $multipart_boundary;
852855
}
853856

854857
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
855858
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
856859
5970 curl_setopt($ch, CURLOPT_HEADER, 1);
857-
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
858-
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
859-
// curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
860860
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
861861

862862
$reply = curl_exec($ch);

0 commit comments

Comments
 (0)
0