[Ur] HTTP client requests

Adam Chlipala adamc at impredicative.com
Wed Nov 3 07:33:30 EDT 2010


Marc Weber wrote:
> Excerpts from Chris Double's message of Wed Nov 03 09:36:29 +0100 2010:
>    
>> Are there any libraries available in Ur/Web for making HTTP requests
>> to other servers? I'd like to be able to call REST and JSON services
>> on a remote server and use the results in pages returned by an Ur/Web
>> app.
>>
>> If there aren't any existing libraries, any thoughts on a good way of
>> doing this?
>>      
> The C library curl is a possible solution which should be evaluated ?
> Some APIs require HTTPs.
> API's I've seen and used requiring HTTP(S) include SMS and payment serivces..
>    

Yes, my first impulse would be to wrap a C library like cURL.  Ur/Web is 
designed so that every side-effecting action is _transactional_, so it 
would help if the remote API you are asking is side-effect-free or 
supports rolling back actions.  Otherwise, you'll need to batch all 
side-effecting actions to take place at once, after the current page 
handler finishes.

The manual has documentation on the C FFI.  If you want to go this 
route, please feel free to post questions about it here.



More information about the Ur mailing list