|
-
October 27th, 2009, 05:57 AM
#1
Download the contents of a URL.
How can i download the contents of a URL using c/c++? Preferably on windows. I have already tried libcurl on linux, but i cant get it to work on windows. Any more ideas or suggestions?
-
October 27th, 2009, 10:22 AM
#2
Re: Download the contents of a URL.
Use (or take a look at the source code of) wget. There is a Windows version.
-
October 27th, 2009, 06:31 PM
#3
Re: Download the contents of a URL.
 Originally Posted by rdrast
Use (or take a look at the source code of) wget. There is a Windows version.
Ok you can download the contents of a URL with wget but they are saved in a file. I would like to assign them to a string so that i can use them later on, instead of opening the file etc...
-
October 30th, 2009, 08:15 AM
#4
Re: Download the contents of a URL.
Any more suggestions? (Has anyone succeeded in installing curl and curlpp on windows? )
-
October 30th, 2009, 03:01 PM
#5
Re: Download the contents of a URL.
I use curl, you shouldn't need to install anything, you just need the library, which you can get ont he website. Make sure you download libcURL, not cURL, and download the Binary. It's GNU C, so it will work with your GNU C or C++ out of the box.
-
October 31st, 2009, 04:15 AM
#6
Re: Download the contents of a URL.
 Originally Posted by ninja9578
I use curl, you shouldn't need to install anything, you just need the library, which you can get ont he website. Make sure you download libcURL, not cURL, and download the Binary. It's GNU C, so it will work with your GNU C or C++ out of the box.
Ok, i downloaded libcurl binary and tried compiling an example that is on the site("simple.c").
I included the path of curl.h like this <curl/curl.h>, but it didnt work , so i used "curl/curl.h".
But i got a bunch of errors:
Code:
In file included from simple.c:2:
curl/curl.h:35:61: curl/curlbuild.h: No such file or directory
In file included from curl/curl.h:36,
from simple.c:2:
curl/curlrules.h:80:4: #error "CURL_SIZEOF_LONG definition is missing!"
In file included from curl/curl.h:36,
from simple.c:2:
curl/curlrules.h:81: error: syntax error before "Compilation_aborted_CURL_SIZEOF_LONG_is_missing"
curl/curlrules.h:85:4: #error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
curl/curlrules.h:90:4: #error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
curl/curlrules.h:95:4: #error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
curl/curlrules.h:100:4: #error "CURL_FORMAT_CURL_OFF_T definition is missing!"
curl/curlrules.h:105:4: #error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
curl/curlrules.h:110:4: #error "CURL_FORMAT_OFF_T definition is missing!"
curl/curlrules.h:115:4: #error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
curl/curlrules.h:120:4: #error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
curl/curlrules.h:125:4: #error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
curl/curlrules.h:142: error: syntax error before "typedef"
curl/curlrules.h:144: error: `CURL_SIZEOF_LONG' undeclared here (not in a function)
curl/curlrules.h:154: error: `curl_off_t' undeclared here (not in a function)
curl/curlrules.h:154: error: `CURL_SIZEOF_CURL_OFF_T' undeclared here (not in a function)
curl/curlrules.h:164: error: size of array `__curl_rule_03__' is negative
curl/curlrules.h:174: error: `curl_socklen_t' undeclared here (not in a function)
curl/curlrules.h:174: error: `CURL_SIZEOF_CURL_SOCKLEN_T' undeclared here (not in a function)
curl/curlrules.h:184: error: size of array `__curl_rule_05__' is negative
In file included from simple.c:2:
curl/curl.h:191: error: syntax error before "curl_off_t"
Did i do something wrong?
-
October 31st, 2009, 03:20 PM
#7
Re: Download the contents of a URL.
Finally i managed to link the necessary libraries and compile my programs. Thank you everyone for your advice!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|