表題の通り、Rakuten.rapid.apiの使用方法がわからず、詰まっています。
開発環境としては
php7.2
laravel5.7
win10
laravelにもともと入っているartisanコマンドの簡易サーバーでうごかしています。
使用したいAPIは
https://api.rakuten.net/andruxnet/api/random-famous-quotes?endpoint=53aa60e4e4b0596140341ca4
です。
apiphp
1$response = Unirest\Request::post("https://andruxnet-random-famous-quotes.p.rapidapi.com/?count=1&cat=famous", 2 array( 3 "X-RapidAPI-Key" => "4c6bf8e325msh1b7a62b2c24675cp136917jsn4b09c909d6e0", 4 "Content-Type" => "application/x-www-form-urlencoded" 5 ) 6)->name('famous_word');
blade
1<form method="POST" action="{{ route('famous_word') }}" > 2 {{ csrf_field() }} 3 4 <input type="text" name="cat" value="famous"> 5 6 <input type="submit"> 7</form>
現在検出されているエラーは
apiphp
1Class 'Unirest\Request' not found
でクラスが見つからないというエラーです。
が
composer.jsonに
composerjson
1 "require-dev": { 2 "mashape/unirest-php": "3.*" 3 }
の記述がされています。
api.phpの宣言に何かを追加しなくてはいけないようなのですが、情報が見つからず。
もしよければご回答いただければと思います。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/07 15:08
2019/01/08 00:31