DataAPIを利用してphpでログインを試みています。
localhostでたたいているのですが、forbiddenとなってログインできません。
nginxのエラーログ access forbidden by rule, client: 127.0.0.1, server: localhost, request: "POST /mt/mt-data-api.cgi/v2/authentication HTTP/1.0", host: "127.0.0.1"
該当のソースコード
PHP
1 2$endpoint = 'http://127.0.0.1/mt/mt-data-api.cgi/v2/authentication'; 3$postdata = array( 4 'username' => 'ユーザー名', 5 'password' => 'パスワード', 6 'clientId' => '任意の名前', 7); 8 9$options = array('http' => 10 array( 11 'method' => 'POST', 12 'content' => http_build_query($postdata), 13 ) 14); 15 16$response = file_get_contents($endpoint, false, stream_context_create($options)); 17var_dump($response); 18
初めて利用します。
足りない情報などございましたら、ご教授下さい。
あなたの回答
tips
プレビュー