From: Brion Vibber Date: Thu, 30 Jul 2009 22:11:44 +0000 (+0000) Subject: Allow passing postdata in Http::post() options... X-Git-Tag: 1.31.0-rc.0~40627 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=ab7470b6e878556d539e7bd407c5310a98761eb0;p=lhc%2Fweb%2Fwiklou.git Allow passing postdata in Http::post() options... Note -- CURL allows you to pass an array which it will encode as multipart, but this doesn't seem to work for me. Until resolved, do URL form encoding yourself with wfArrayToCGI() and pass in a string. Todo: implement also for non-CURL mode if possible? --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index e4b73f9a82..338f1e0676 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -287,6 +287,7 @@ class HttpRequest { $this->upload_session_key = ( isset( $opt['upload_session_key'] ) ) ? $opt['upload_session_key'] : false; $this->headers_only = ( isset( $opt['headers_only'] ) ) ? $opt['headers_only'] : false; $this->do_close_session_update = isset( $opt['do_close_session_update'] ); + $this->postData = isset( $opt['postdata'] ) ? $opt['postdata'] : ''; } /** @@ -331,7 +332,7 @@ class HttpRequest { curl_setopt( $c, CURLOPT_HEADER, true ); } elseif ( $this->method == 'POST' ) { curl_setopt( $c, CURLOPT_POST, true ); - curl_setopt( $c, CURLOPT_POSTFIELDS, '' ); + curl_setopt( $c, CURLOPT_POSTFIELDS, $this->postData ); } else { curl_setopt( $c, CURLOPT_CUSTOMREQUEST, $this->method ); }