Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UTL_HTTP.set_header question

I_love_bitsJul 2 2015 — edited Jul 2 2015

Dear expert,

I'm trying to simulate a web request to download a PDF from iThenticate (plagiarism detection service, Plagiarism Detection Software | iThenticate).

Therefore I need to set a cookie with a session ID (see code below) in my request (UTL_HTTP).

Since I always get the JSON respond '{"error":"Please log in"}' I know I do something wrong.

What do you think about the code below? Is it ok to set the cookie via SET_HEADER?

From the following request I should get back an URL to the plagiat report (but as I mentioned I get "Pleas log in"):

l_url := 'https://api.ithenticate.com/paper/' || l_iThenticateFileID || '/queue_pdf?%26lang=en_us%26output=json';

l_http_request := UTL_HTTP.begin_request (l_url, 'POST', ' HTTP/1.1');

UTL_HTTP.set_header (l_http_request, 'Host', 'api.ithenticate.com');    

UTL_HTTP.set_header (l_http_request, 'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0');

UTL_HTTP.set_header (l_http_request, 'X-Requested-With', 'XMLHttpRequest');

UTL_HTTP.set_header (l_http_request, 'content-type', 'application/json; charset=UTF-8'); 

UTL_HTTP.set_header (l_http_request, 'Referer', 'https://api.ithenticate.com/ithenticate_dv?lang=en_us%26o=' || l_iThenticateFileID); 

UTL_HTTP.set_header (l_http_request, 'Content-Length', length(l_content));

UTL_HTTP.set_header (l_http_request, 'Cookie', 'use_text=0; _ga=GA1.2.1234567890.123456789; ithenticate_session=9c6933a4dfb5199281d75612531cf212b8183f21'); --' || l_sid );     

UTL_HTTP.set_header (l_http_request, 'Connection', 'keep-alive');

UTL_HTTP.write_text (l_http_request, '{"as":1,"or_type":"similarity"}');

l_http_response := UTL_HTTP.get_response (l_http_request);

Thanks for any hint,

rrr

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2015
Added on Jul 2 2015
4 comments
1,411 views