I am trying to download an html page as text file by executing the "curl" command under XCODE (Mac).
I already do that with the "wget" command under windows environment (Borland) and it is working well.
I am basically trying to run the same cpp code under XCODE environment by replacing the "wget" command with "curl" command.
Perhaps, as additional info, I use the "curl" for downloading some other link under XCODE and it is working fine, but I get problems only with this kind of link:
for executing this command I do the following:
// let's copy the command to a string
char string[] = "curl -o FileOut.txt "https://tools.morningstar.it/api/rest.svc/timeseries_cumulativereturn/jbyiq3rhyf?currencyId=EUR&idtype=Morningstar&frequency=daily&startDate=1970-01-01&performanceType=&outputType=COMPACTJSON&id=F000000RTP]2]0]FOITA2792ALL&decPlaces=8&applyTrackRecordExtension=true%20-%20Cerca%20con%20Google"";
// lets execute the command
system (string);
after executing the curl command the output contains just 14 bytes: "<TimeSeries />
". instead of the whole data.
As far as I have understood in other treads I should add the character before the & characters, maybe also before the : characters.
I have also added the " to the string array at the beginning and end of the link, but it doesn’t help.
if I try to copy and paste this link to the browser I perfectly see the data (and I see also the data in my windows environment downloaded to the output file).
2
Answers
Thanks guys, that's awesome!
I got the right solution thanks to molbdnilo and Daniel feedbacks!
It was related to the bracket message error and the use of -g option that, honestly, I still don't understand what is that.
I will read the documentation of the curl command (I did already before) but honestly, I am wondering how you all can understand the help... sometimes it is really hard for me to understand what they are talking about ! Well, Im a newbie, maybe that's why :)
Many thanks again, topic is considered closed !
Oh, as last, I had to add " into the string (beginning and end) to let the string passed to the curl command include two "" characters.
Grazie ! :)