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 and POST (and receive a file in response)

JackKNov 5 2007 — edited Dec 28 2007
Hi.

I want to make a request into page http://www.money.pl/gielda/archiwum/spolki/ and receive a file which is given to requestor according the request.
This are form's field must be send:
name="stock" value="TVN"
name="day_from" value="25"
name="month_from" value="10"
name="year_from" value="2007"
name="period" value="7"
name="format" value="csv"
name="periodarchive" value="Szukaj"
I tried this:
DECLARE
   req     Utl_Http.req;
   resp    Utl_Http.resp;
   NAME    VARCHAR2 (255);
   VALUE_   VARCHAR2 (1023);
   v_msg   VARCHAR2 (1000);
   v_url   VARCHAR2 (32767) := 'http://www.money.pl/gielda/archiwum/spolki/';
BEGIN
   Utl_Http.set_response_error_check (ENABLE => TRUE );
   Utl_Http.set_detailed_excp_support (ENABLE => TRUE );
   
   req := Utl_Http.begin_request (url => v_url, method => 'POST');

    v_msg := v_msg || 'stock = "TVN",'; 
    v_msg := v_msg || ',day_from = "26"'; 
    v_msg := v_msg || ',month_from = "11"'; 
    v_msg := v_msg || ',year_from = "2007"'; 
    v_msg := v_msg || ',period = "7"'; 
    v_msg := v_msg || ',format = "cvs"'; 
    v_msg := v_msg || ',periodarchive = "Szukaj"'; 

    Utl_Http.set_header (r => req, NAME => 'User-Agent', value => 'Mozilla/4.0');
    utl_http.set_header(req, 'content-type', 'text/html');
    utl_http.set_header(req, 'content-length', length(v_msg));
    resp := Utl_Http.get_response (r => req);

   DBMS_OUTPUT.put_line ('Status code: ' || resp.status_code);
   DBMS_OUTPUT.put_line ('Reason phrase: ' || resp.reason_phrase);
END;
but I receive error:
ORA-29259: end-of-input reached
Could you help me, please?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 25 2008
Added on Nov 5 2007
14 comments
16,765 views