Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Curl, how to read return data?
    text
    copied!<p>I am trying to use curl and <a href="http://www.deanclatworthy.com/imdb" rel="nofollow">http://www.deanclatworthy.com/imdb</a> to get movie and tv show information from IMDB. I am using the simple.c example from <a href="http://curl.haxx.se/libcurl/c/simple.html" rel="nofollow">http://curl.haxx.se/libcurl/c/simple.html</a></p> <pre><code>cout &lt;&lt; "Type a movie name: " &lt;&lt; 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); } </code></pre> <p>This is my output, if i search for The Dark Knight Rises: </p> <p><strong>Type a movie name:</strong> The Dark Knight Rises <strong>{"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":"The Dark Knight Rises","year":"2012","usascreens":4404,"ukscreens":0}</strong></p> <p>My problem is that i want the text that is returned, with the information, to be put into an array so i can get it up nice, e.g.</p> <pre><code>movieInto[14] = *array* </code></pre> <p>and then i can call the different parts of the array if i want to title, rating, year and so on. It is already formatted as an array but i cant figure out what to call to get the into. </p> <p>Hope the bright minds in here can help me out =)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload