Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php |
— | — | @@ -115,16 +115,15 @@ |
116 | 116 | } |
117 | 117 | |
118 | 118 | protected function captureEmail( $email, $json ) { |
119 | | - global $wgScriptPath, $wgServer; |
120 | | - $url = "$wgServer$wgScriptPath/api.php"; |
121 | | - $body = "email=$email&info=$json&action=emailcapture&format=json"; |
122 | | - $c = curl_init ( $url ); |
123 | | - curl_setopt( $c, CURLOPT_POST, true ); |
124 | | - curl_setopt( $c, CURLOPT_POSTFIELDS, $body ); |
125 | | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, true ); |
126 | | - |
127 | | - $rv = curl_exec( $c ); |
128 | | - curl_close( $c ); |
| 119 | + # http://www.mediawiki.org/wiki/API:Calling_internally |
| 120 | + $params = new FauxRequest( array( |
| 121 | + 'action' => 'emailcapture', |
| 122 | + 'format' => 'json', |
| 123 | + 'email' => $email, |
| 124 | + 'info' => $json |
| 125 | + ) ); |
| 126 | + $api = new ApiMain( $params, true ); |
| 127 | + $api->execute(); |
129 | 128 | } |
130 | 129 | |
131 | 130 | /** |