; docformat = 'rst' ;+ ; Get the content for the given URL. ; ; :Returns: ; string, strarr ; ; :Params: ; url : in, required, type=string ; complete URL to get content for, including "http://" ; ; :Keywords: ; error : out, optional, type=boolean ; pass a named variable, will be set if an error occurs in getting the ; content of the URL (in which case the return value will be the empty ; string) ; response_code : out, optional, type=boolean ; response code for get attempt, 200 is OK ;- function mg_get_url_content, url, error=error, response_code=response_code compile_opt strictarr error = 0L errorNumber = 0L catch, errorNumber if (errorNumber ne 0L) then begin catch, /cancel error = 1L ourl->getProperty, response_code=response_code if (obj_valid(ourl)) then obj_destroy, ourl return, '' endif ourl = obj_new('IDLnetURL') content = ourl->get(url=url, /string_array) ourl->getProperty, response_code=response_code obj_destroy, ourl return, content end