curlとhttp://www.deanclatworthy.com/imdbを使用して、IMDBから映画やテレビ番組の情報を取得しようとしています。http://curl.haxx.se/libcurl/c/simple.htmlのsimple.cの例を使用しています
cout << "Type a movie name: " << endl;
getline(cin, searchTerm);
replace(searchTerm.begin(), searchTerm.end(), ' ', '+');
CURL *curl;
CURLcode res;
string temp;
temp = "http://www.deanclatworthy.com/imdb/?q=" + searchTerm;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, temp.c_str());
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
ダークナイトライジングを検索した場合、これは私の出力です。
映画名を入力してください: ダークナイトライジング {"imdbid": "tt1345836"、 "imdburl": "http://www.imdb.com/title/tt1345836/"、 "genres": "Action、Crime、Thriller" 、"languages": "English"、 "country": "USA、UK"、 "votes": "390735"、 "stv":0、 "series":0、 "rating": "8.8"、 "runtime" :"165min"、 "title": "ダークナイトライジング"、 "year": "2012"、 "usascreens":4404、 "ukscreens":0}
私の問題は、返されるテキストとその情報を配列に入れて、うまく立ち上げることができるようにすることです。
movieInto[14] = *array*
次に、タイトル、評価、年などを指定する場合は、配列のさまざまな部分を呼び出すことができます。すでに配列としてフォーマットされていますが、に入るには何を呼び出すべきかわかりません。
ここの明るい心が私を助けることができることを願っています=)