私のコントローラでこのコードを使用してKohana 3.1で外部リクエストを実行しようとしています。私はこのエラーを取得していkohana 3.1外部リクエスト:POSTアプリケーション/ xmlがネイティブでは動作しません
$request = Request::factory($url);
$request->method(Request::POST);
$request->body($xml);
$request->headers('Content-Type', 'application/xml');
$response = $request->execute();
:コード内のいくつかの研究の後
HTTP_Exception_500 [ 500 ]: Kohana_HTTP_Header_Value::__construct unknown header value type: integer. array or string allowed.
、私はこれはクラスKohana_Request_Client_External
の機能_native_execute
に問題だったが分かりました。
ようなので、この機能セット「コンテンツ長」:
$body = $request->body();
$request->headers('content-length', strlen($body));
しかし$request->header(...)
が文字列または2番目のパラメータのアレイとstrlen
を期待する整数を返します。
バグですか?
ErrorException [ Warning ]: fopen(http://xxx.xxx.xxx.xxx/yyyyy) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP wrapper does not support writeable connections
このエラーは_native_execute
で再びコード$mode = ($request->method() === HTTP_Request::GET) ? 'r' : 'r+';
のこの行から来ている:私はその後、私は別のエラーを得た。この$request->headers('content-length', (string)strlen($body));
のようにそれを修正しました。
私は$mode
の値をr
としましたが、今は動作します。これらの2つのエラーはバグですか、何か間違っていますか?
知っておきたいことです – jackdbernier