-
- if ($GLOBALS['fetch_last_error_code'] == 201) {
- //FIXME: extract location header
- echo "OK, comment post created\n";
- } else {
- $this->errorOut(
+ $meta = stream_get_meta_data($stream);
+ $headers = $meta['wrapper_data'];
+ $content = stream_get_contents($stream);
+
+ //we hope there were no redirects and this is actually the only
+ // HTTP line in the headers
+ $status = array_shift($headers);
+ list($httpver, $code, $text) = explode(' ', $status, 3);
+ if ($code != 201 && $code != 202) {
+ return $this->errorOut(