How to handle HTTP GET request?

Started by KAKAN, May 14, 2016, 10:03 AM

Previous topic - Next topic

KAKAN

Well, I'm trying to handle a HTTP GET request to a website. How can I store the output?
Something like the AJAX request to get a XML, but in my case, JSON
How to do it? Any examples would be useful :)
oh no

vito

Yep something as JSON.parse for vc-mp will be fine :D But I think you have to do it yourself :(

KAKAN

Quote from: vito on May 14, 2016, 10:45 AMYep something as JSON.parse for vc-mp will be fine :D But I think you have to do it yourself :(
This is not about JSON.parse, I want to make a GET request to a HTTP server.
oh no

vito

You need proxy like a php server or something else if this thing can read your vc-mp's database and make http requests.
No native way to do that.

KAKAN

Quote from: vito on May 14, 2016, 02:19 PMYou need proxy like a php server or something else if this thing can read your vc-mp's database and make http requests.
No native way to do that.
What about sockets though? Using database and a HTTP handler to get a JSON data from a website is complete shit.
oh no

Stormeus

Quote from: KAKAN on May 14, 2016, 04:11 PM
Quote from: vito on May 14, 2016, 02:19 PMYou need proxy like a php server or something else if this thing can read your vc-mp's database and make http requests.
No native way to do that.
What about sockets though? Using database and a HTTP handler to get a JSON data from a website is complete shit.

Already been done, but the source code is lost.
http://viceunderdogs.com/index.php?topic=3087.msg35628#msg35628

I honestly wouldn't recommend running an HTTP server off Squirrel sockets since each request you have to handle takes processing time away from the scripts and server core.

KAKAN

Quote from: Stormeus on May 14, 2016, 04:27 PM
Quote from: KAKAN on May 14, 2016, 04:11 PM
Quote from: vito on May 14, 2016, 02:19 PMYou need proxy like a php server or something else if this thing can read your vc-mp's database and make http requests.
No native way to do that.
What about sockets though? Using database and a HTTP handler to get a JSON data from a website is complete shit.

Already been done, but the source code is lost.
http://viceunderdogs.com/index.php?topic=3087.msg35628#msg35628

I honestly wouldn't recommend running an HTTP server off Squirrel sockets since each request you have to handle takes processing time away from the scripts and server core.
Make it again pls, and also, I'm not going to run a HTTP server.
I'm trying to get a JSON from a page, which I think can be done from a sockets, but since, we can't change the connect string, it's not useful for me :(
oh no

vito

Quote from: KAKAN on May 14, 2016, 04:11 PMWhat about sockets though? Using database and a HTTP handler to get a JSON data from a website is complete shit.
Compilte shit or nothing, simple choice for curret time xD

ysc3839

Quote from: . on Apr 19, 2016, 09:52 PM
Quote from: vcmptr on Apr 19, 2016, 09:39 PMHTTP page downloader. Like this. I've tried with sockets but I could not.

I have that planned for a module that wraps the Mongoose library. It's still a work in progress but when finished, it should provide a fully functional HTTP server/client with support for web-sockets for real time live maps (no more jsoon files). As well as TCP and UDP communications.

However, I need to implement that in a way that doesn't affect the frame-rate.Which means I'd have to run it into a separate thread. And since Squirrel is not a thread safe language. I'm not sure how to achieve that without creating a bottleneck from all the context switching to communicate between threads. Which means that this module is still pending for now.

And I can't see any safe and decent way of going with this so I might spend a while until I come up with something.

ysc3839

#9
Quote from: KAKAN on May 14, 2016, 04:53 PM
Quote from: Stormeus on May 14, 2016, 04:27 PM
Quote from: KAKAN on May 14, 2016, 04:11 PM
Quote from: vito on May 14, 2016, 02:19 PMYou need proxy like a php server or something else if this thing can read your vc-mp's database and make http requests.
No native way to do that.
What about sockets though? Using database and a HTTP handler to get a JSON data from a website is complete shit.

Already been done, but the source code is lost.
http://viceunderdogs.com/index.php?topic=3087.msg35628#msg35628

I honestly wouldn't recommend running an HTTP server off Squirrel sockets since each request you have to handle takes processing time away from the scripts and server core.
Make it again pls, and also, I'm not going to run a HTTP server.
I'm trying to get a JSON from a page, which I think can be done from a sockets, but since, we can't change the connect string, it's not useful for me :(
I think it's easy to do that.
Developers should fix the socket plugin's issue first. When the client send data to server, the server will crash. I have reported this months ago, but still havn't fixed yet.