DataAPIを使って記事の一覧を表示することはできます。
そのあとにログインして、記事の作成・更新とできるようにしたいのですがログインができません。
以下エラー文です。
サイトの権限は自分がオーナーです。
failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in
<?php // ログイン処理 $endpoint = 'http://ホスト名/mt/MT-6.3/mt-data-api.cgi/v1/authentication'; $userName = 'ログイン名'; $password = 'パス'; 'clientID' => '任意の名前' $postData = array ( 'usrName' => $userName, 'password' => $password, 'clientId' => 'example' ); $options = array('http' => array( 'method' => 'POST', 'header' => array('Content-Type: application/x-www-form-urlencoded'), // 'content' => http_build_query( $postData ), ) ); // エラー箇所 $response = file_get_contents( $endpoint, false, stream_context_create( $options ) ); var_dump( $response ); if ( !$response ) { echo "ログインできませんでした"; exit(); } $json = json_decode( $response ); $accessToken = $json->accessToken;
よろしくお願いします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。