{{ message }}
Repository navigation
Expand file tree
/
Copy pathUPDATE_1DAYLATER_001.prc
More file actions
274 lines (258 loc) · 9.59 KB
/
Copy pathUPDATE_1DAYLATER_001.prc
File metadata and controls
274 lines (258 loc) · 9.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
CREATE OR REPLACE PROCEDURE ALMAGESTO.update_1daylater_001
--SOLO LA PRIMA VOLTA, POI ANDARE IN INTERNET A PRENDERE IL VERIFICATION CODEurlencode
AS
oauth_get_request_token_url CONSTANT VARCHAR2 (1000) := 'http://1daylater.com/get_request_token';
oauth_get_access_token_url CONSTANT VARCHAR2 (1000) := 'http://1daylater.com/get_access_token';
oauth_callback CONSTANT VARCHAR2 (1000) := 'oob';
oauth_consumer_key CONSTANT VARCHAR2 (50) := urlencode ('NHx8CZzuf9XEF6C2ksimwDkS7Fw=');
oauth_nonce VARCHAR2 (50);
oauth_signature_method CONSTANT VARCHAR2 (10) := urlencode ('HMAC-SHA1');
oauth_timestamp VARCHAR2 (50);
oauth_version CONSTANT VARCHAR2 (5) := urlencode ('1.0');
oauth_consumer_secret CONSTANT VARCHAR2 (50) := '7XF7YN/rNzYcqDlJFsTqyC81KWw=';
oauth_token VARCHAR2 (500);
oauth_token_secret VARCHAR2 (500);
oauth_verifier VARCHAR2 (500) := 'vd3fgs3D';
oauth_base_string VARCHAR2 (4000);
oauth_key VARCHAR2 (500) := urlencode (oauth_consumer_secret) || '&';-- || urlencode (oauth_token);
oauth_signature VARCHAR2 (100);
l_sig_mac RAW (2000);
http_req_url VARCHAR2 (4000);
http_method VARCHAR2 (5) := 'GET';
http_req UTL_HTTP.req;
http_resp UTL_HTTP.resp;
h_name VARCHAR2 (255);
h_value VARCHAR2 (1023);
res_value VARCHAR2 (32767);
show_header NUMBER := 0;
show_xml NUMBER := 1;
BEGIN
SELECT urlencode (oauth_nonce_seq.NEXTVAL)
INTO oauth_nonce
FROM DUAL;
SELECT urlencode ((SYSDATE - TO_DATE ('01-01-1970', 'DD-MM-YYYY')) * (86400)) - 7200
INTO oauth_timestamp
FROM DUAL;
oauth_base_string :=
http_method
|| '&'
|| urlencode (oauth_get_request_token_url)
|| '&'
|| urlencode ( 'oauth_callback'
|| '='
|| oauth_callback
|| '&'
|| 'oauth_consumer_key'
|| '='
|| oauth_consumer_key
|| '&'
|| 'oauth_nonce'
|| '='
|| oauth_nonce
|| '&'
|| 'oauth_signature_method'
|| '='
|| oauth_signature_method
|| '&'
|| 'oauth_timestamp'
|| '='
|| oauth_timestamp
|| '&'
|| 'oauth_version'
|| '='
|| oauth_version);
--DBMS_OUTPUT.put_line (oauth_base_string);
l_sig_mac :=
DBMS_CRYPTO.mac (UTL_I18N.string_to_raw (oauth_base_string, 'AL32UTF8')
,DBMS_CRYPTO.hmac_sh1
,UTL_I18N.string_to_raw (oauth_key, 'AL32UTF8'));
oauth_signature := UTL_RAW.cast_to_varchar2 (UTL_ENCODE.base64_encode (l_sig_mac));
DBMS_OUTPUT.put_line ('MAC Signature (Base64-encoded): ' || oauth_signature);
UTL_HTTP.set_proxy ('proxy02.sas.junta-andalucia.es:8080');
http_req_url :=
oauth_get_request_token_url
|| '?'
|| 'oauth_callback'
|| '='
|| oauth_callback
|| '&'
|| 'oauth_consumer_key'
|| '='
|| oauth_consumer_key
|| '&'
|| 'oauth_nonce'
|| '='
|| oauth_nonce
|| '&'
|| 'oauth_signature'
|| '='
|| urlencode (oauth_signature)
|| '&'
|| 'oauth_signature_method'
|| '='
|| oauth_signature_method
|| '&'
|| 'oauth_timestamp'
|| '='
|| oauth_timestamp
|| '&'
|| 'oauth_version'
|| '='
|| oauth_version;
http_req := UTL_HTTP.begin_request (http_req_url, http_method, UTL_HTTP.http_version_1_1);
UTL_HTTP.set_response_error_check (TRUE);
UTL_HTTP.set_detailed_excp_support (TRUE);
UTL_HTTP.set_body_charset (http_req, 'UTF-8');
UTL_HTTP.set_header (http_req, 'User-Agent', 'Mozilla/4.0');
http_resp := UTL_HTTP.get_response (http_req);
DBMS_OUTPUT.put_line ('status code: ' || http_resp.status_code);
DBMS_OUTPUT.put_line ('reason phrase: ' || http_resp.reason_phrase);
IF show_header = 1
THEN
FOR i IN 1 .. UTL_HTTP.get_header_count (http_resp)
LOOP
UTL_HTTP.get_header (http_resp, i, h_name, h_value);
DBMS_OUTPUT.put_line (h_name || ': ' || h_value);
END LOOP;
END IF;
IF show_xml = 1
THEN
BEGIN
WHILE 1 = 1
LOOP
UTL_HTTP.read_line (http_resp, res_value, TRUE);
DBMS_OUTPUT.put_line (res_value);
IF INSTR (res_value, 'oauth_token') > 0 THEN
oauth_token := UTL_URL.UNESCAPE (SUBSTR (res_value, 13, instr(res_value, '&oauth_token_secre') - INSTR (res_value, 'oauth_token') - 12));
oauth_token_secret := UTL_URL.UNESCAPE(SUBSTR (res_value, instr(res_value, '&oauth_token_secret') + 20, instr(res_value, '&oauth_callback_confirmed')- instr(res_value, '&oauth_token_secret') - 20));
DBMS_OUTPUT.put_line ('oauth_token:'||oauth_token);
DBMS_OUTPUT.put_line ('oauth_token_secret:'||oauth_token_secret);
oauth_key := urlencode (oauth_consumer_secret) || '&' || urlencode (oauth_token_secret);
DBMS_OUTPUT.put_line ('oauth_key:'||oauth_key);
END IF;
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body
THEN
NULL;
END;
END IF;
UTL_HTTP.end_response (http_resp);
/*
oauth_base_string :=
http_method
|| '&'
|| urlencode (oauth_get_access_token_url)
|| '&'
|| urlencode (
'oauth_consumer_key'
|| '='
|| oauth_consumer_key
|| '&'
|| 'oauth_nonce'
|| '='
|| oauth_nonce
|| '&'
|| 'oauth_signature_method'
|| '='
|| oauth_signature_method
|| '&'
|| 'oauth_timestamp'
|| '='
|| oauth_timestamp
|| '&'
|| 'oauth_token'
|| '='
|| oauth_token
|| '&'
|| 'oauth_verifier'
|| '='
|| oauth_verifier
|| '&'
|| 'oauth_version'
|| '='
|| oauth_version);
DBMS_OUTPUT.put_line ('oauth_base_string:'||oauth_base_string);
oauth_key := urlencode(oauth_consumer_secret) || '&' || urlencode(oauth_token_secret);
DBMS_OUTPUT.put_line ('oauth_key:'||oauth_key);
l_sig_mac :=
DBMS_CRYPTO.mac (UTL_I18N.string_to_raw (oauth_base_string, 'AL32UTF8')
,DBMS_CRYPTO.hmac_sh1
,UTL_I18N.string_to_raw (oauth_key, 'AL32UTF8'));
oauth_signature := UTL_RAW.cast_to_varchar2 (UTL_ENCODE.base64_encode (l_sig_mac));
DBMS_OUTPUT.put_line ('MAC Signature (Base64-encoded): ' || oauth_signature);
UTL_HTTP.set_proxy ('proxy02.sas.junta-andalucia.es:8080');
http_req_url :=
oauth_get_access_token_url
|| '?'
|| 'oauth_consumer_key'
|| '='
|| oauth_consumer_key
|| '&'
|| 'oauth_nonce'
|| '='
|| oauth_nonce
|| '&'
|| 'oauth_signature'
|| '='
|| urlencode (oauth_signature)
|| '&'
|| 'oauth_signature_method'
|| '='
|| oauth_signature_method
|| '&'
|| 'oauth_timestamp'
|| '='
|| oauth_timestamp
|| '&'
|| 'oauth_token'
|| '='
|| oauth_token
|| '&'
|| 'oauth_verifier'
|| '='
|| oauth_verifier
|| '&'
|| 'oauth_version'
|| '='
|| oauth_version;
DBMS_OUTPUT.put_line ('http_req:'||http_req_url);
http_req := UTL_HTTP.begin_request (http_req_url, http_method, UTL_HTTP.http_version_1_1);
UTL_HTTP.set_response_error_check (TRUE);
UTL_HTTP.set_detailed_excp_support (TRUE);
UTL_HTTP.set_body_charset (http_req, 'UTF-8');
UTL_HTTP.set_header (http_req, 'User-Agent', 'Mozilla/4.0');
http_resp := UTL_HTTP.get_response (http_req);
DBMS_OUTPUT.put_line ('status code: ' || http_resp.status_code);
DBMS_OUTPUT.put_line ('reason phrase: ' || http_resp.reason_phrase);
IF show_header = 1
THEN
FOR i IN 1 .. UTL_HTTP.get_header_count (http_resp)
LOOP
UTL_HTTP.get_header (http_resp, i, h_name, h_value);
DBMS_OUTPUT.put_line (h_name || ': ' || h_value);
END LOOP;
END IF;
IF show_xml = 1
THEN
BEGIN
WHILE 1 = 1
LOOP
UTL_HTTP.read_line (http_resp, res_value, TRUE);
DBMS_OUTPUT.put_line (res_value);
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body
THEN
NULL;
END;
END IF;
UTL_HTTP.end_response (http_resp);
*/
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
RAISE;
END update_1daylater_001;
/
You can’t perform that action at this time.
