Created
November 12, 2022 21:36
-
-
Save fleischr/0eb0f029222382ec22d70e3a66b55d52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
report zreadfilefromuri. | |
DATA: | |
lo_http_client TYPE REF TO IF_HTTP_CLIENT. | |
DATA: | |
lv_str TYPE XSTRING, | |
lv_i TYPE I. | |
CALL METHOD cl_http_client=>create_by_url | |
EXPORTING | |
url = iv_url | |
IMPORTING | |
client = lo_http_client | |
EXCEPTIONS | |
argument_not_found = 1 | |
plugin_not_active = 2 | |
internal_error = 3. | |
CHECK sy-subrc = 0. | |
lo_http_client->propertytype_logon_popup = lo_http_client->co_disabled. | |
lo_http_client->request->set_header_field( EXPORTING name = '~request_method' | |
value = 'GET' ). | |
lo_http_client->request->set_header_field( EXPORTING name = '~server_protocol' | |
value = 'HTTP/1.1' ). | |
CALL METHOD lo_http_client->send | |
EXCEPTIONS | |
http_communication_failure = 1 | |
http_invalid_state = 2. | |
CHECK sy-subrc = 0. | |
CALL METHOD lo_http_client->receive | |
EXCEPTIONS | |
http_communication_failure = 1 | |
http_invalid_state = 2 | |
http_processing_failed = 3. | |
CHECK sy-subrc = 0. | |
lo_http_client->response->get_status( IMPORTING code = lv_i ). | |
CHECK lv_i = 200. | |
lv_str = lo_http_client->response->get_data( ). | |
rv_content = lv_str. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment