Extracting arguments from a URL with Erlang

2

I need a lot of help in Erlang because I'm a beginner in language. I am doing a work with some friends that consists in the development of a service oriented bus, allowing to handle several requests. I'm looking for a solution to how the URL from the bus client will handle the extraction of arguments.

Parameters can be from the URL (URL / parameter1 / parameter2) or the Query URL type? param=value&param1=value1

If someone has some code example of how it could be done, I'll be grateful. For a better visualization of the problem the code of the bus that is being constructed is in GITHUB in the link:

link

Thank you in advance

    
asked by anonymous 03.05.2015 / 01:05

1 answer

0

The module http_uri has a parse function capable of interpreting a URL. Calling it with the default options:

parse("http://example.com:8080/path/to/resource?q1=foo&q2=bar#fragmento")

Result:

{http,[],"example.com",8080,"/path/to/resource","?q1=foo&q2=bar#fragmento"}

Example in ideone . There are some options to customize the interpretation of the URL (see the documentation for parse/2 ), but I did not quite understand how to use them (I'm also a beginner in Erlang).

    
03.05.2015 / 02:42