Hi Everyone,
I'm trying to build a newsfeed into my application using an API from Feedzilla. I would like to be able to call the REST API and display the results in a list control. I would be happy to share this with the group once I get the whole thing working.
At this point I have various parts working but can't seem to get my head around how it's all supposed to fit together.
The first issue I have run into is using cURL. I watched the video on how you can use curl commands in the interactive window to call the API. In the example code below it works and I get back a JSON string of news articles.
dim cf_1 as extension::CurlFile
dim flag_1 as l
dim ce as extension::Curl
debug(1)
ce = extension::Curl.Init()
ce.setOpt("URL","http://api.feedzilla.com/v1/categories/26/articles.json")
ce.setOpt("NOPROGRESS",1)
ce.setOpt("USERAGENT","curl/7.34.0")
ce.setOpt("MAXREDIRS",50)
ce.setOpt("TCP_KEEPALIVE",1)
ce.SetOpt("FILE",cf_1)
flag_1 = ce.Exec()
if flag_1 then
' showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.GetContent())
else
showvar("error: " + ce.Error() )
end if
The problem is how do I incorporate this into my actual application. If I build this code into a global function and try to debug it from my application in working preview the cURL code command won't work. So is curl just for browsing? How do I actually call the API from my application? Does it have to be on the server to work?
Secondly, how do I get the JSON string out of GetContent(). I want to parse the JSON in the GetContent() object into an Xbasic dot variable but I can't seem to get the data out of GetContent() into something I can run the JsonParse statement on.
Again, will be happy to share the whole solution for adding news feeds which is a great way to jazz up a mobile app. You can specify in the API call which types of news you prefer and its free.
Thanks,
Scott
I'm trying to build a newsfeed into my application using an API from Feedzilla. I would like to be able to call the REST API and display the results in a list control. I would be happy to share this with the group once I get the whole thing working.
At this point I have various parts working but can't seem to get my head around how it's all supposed to fit together.
The first issue I have run into is using cURL. I watched the video on how you can use curl commands in the interactive window to call the API. In the example code below it works and I get back a JSON string of news articles.
dim cf_1 as extension::CurlFile
dim flag_1 as l
dim ce as extension::Curl
debug(1)
ce = extension::Curl.Init()
ce.setOpt("URL","http://api.feedzilla.com/v1/categories/26/articles.json")
ce.setOpt("NOPROGRESS",1)
ce.setOpt("USERAGENT","curl/7.34.0")
ce.setOpt("MAXREDIRS",50)
ce.setOpt("TCP_KEEPALIVE",1)
ce.SetOpt("FILE",cf_1)
flag_1 = ce.Exec()
if flag_1 then
' showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.GetContent())
else
showvar("error: " + ce.Error() )
end if
The problem is how do I incorporate this into my actual application. If I build this code into a global function and try to debug it from my application in working preview the cURL code command won't work. So is curl just for browsing? How do I actually call the API from my application? Does it have to be on the server to work?
Secondly, how do I get the JSON string out of GetContent(). I want to parse the JSON in the GetContent() object into an Xbasic dot variable but I can't seem to get the data out of GetContent() into something I can run the JsonParse statement on.
Again, will be happy to share the whole solution for adding news feeds which is a great way to jazz up a mobile app. You can specify in the API call which types of news you prefer and its free.
Thanks,
Scott
Comment