REPORT z_barry_test_http_get LINE-SIZE 256 .
TYPES: BEGIN OF text,
line(256),
END OF text.
DATA: status(3) TYPE c,
statustext(128) TYPE c,
rlength TYPE i .
DATA: response TYPE TABLE OF text WITH HEADER LINE,
response_headers TYPE TABLE OF text WITH HEADER LINE.
PARAMETERS: url(256) TYPE c LOWER CASE default '' &
'huobizhengce/huobizhengcegongju/huilvzhengce/' &
'renminbihuilvjiaoyishoupanjia.asp' ,
dest LIKE rfcdes-rfcdest DEFAULT 'SAPHTTP'.
START-OF-SELECTION.
CALL FUNCTION 'HTTP_GET'
EXPORTING
absolute_uri = url
rfc_destination = dest
blankstocrlf = 'Y'
*
proxy = '10.99.60.203:8080'
IMPORTING
status_code = status
status_text = statustext
response_entity_body_length = rlength
TABLES
response_entity_body = response
response_headers = response_headers.
LOOP AT response_headers.
WRITE response_headers-line.
ENDLOOP.
SKIP 2.
LOOP AT response.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
IN response-line WITH ' '.
WRITE response-line.
ENDLOOP.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = dest
EXCEPTIONS
OTHERS = 0.
阅读(5319) | 评论(2) | 转发(1) |