Is it possible to create a plsql procedure to save the return of an HTML web page in the oracle table ?
Currently I need a procedure that returns the html based on an inserted url and saves it in an oracle table
thanks all
Sure it is possible. Here is an example using APEX_WEB_SERVICE.MAKE_REST_REQUEST. This requires that APEX is installed in the database which is a no-cost option. This API is a wrapper around UTL_HTTP so if you don't want to go the APEX route, consider writing a procedure using UTL_HTTP.
declare
l_clob CLOB;
BEGIN
l_clob := apex_web_service.make_rest_request(
p_url => 'https://apex.oracle.com',
p_http_method => 'GET');
dbms_output.put_line(dbms_lob.substr(l_clob,1000,1));
END
/
<!DOCTYPE html>
<html class="no-js" itemscope="itemscope" itemtype="http://schema.org/WebPage" lang="en" data-base-path="../en/">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Oracle APEX</title>
<meta name="title" itemprop="name" content="Oracle APEX" />
<meta name="description" itemprop="description" content="Oracle APEX is the world's most popular enterprise low-code application platform that enables you to build scalable, secure web and mobile apps, with world-class features, that can be deployed anywhere – cloud or on premises." />
<meta name="keywords" content="Oracle APEX, oracle database, low code, application development, app dev, platform, enterprise, " />
<meta name="updated" content="01-AUG-2024 14:22:04" />
<meta name="version" content="398" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:
Statement processed.
However, the correct access control lists need to be setup in the database. By default, nothing is allowed for security reasons. In addition, for any https sites, the site certificate needs to be uploaded in the database wallet. Tim Hall has an excellent article on that.