I've been trying to get read the friends timeline using Oracle PL/
SQL's UTL_HTTP method but for some reason it throws a "HTTP client 400
- Bad Request" message at line #19 - line with the get_response()
function. This piece of code works perfectly well for others. I'm
using Oracle XE. Could you please help?
DECLARE
http_req utl_http.req;
http_resp utl_http.resp;
t_update_send VARCHAR2(200);
res_value VARCHAR2(4000);
XML_RETURN CLOB;
BEGIN
t_update_send := '--head';
http_req := utl_http.begin_request('http://twitter.com/statuses/
friends_timeline.xml', 'POST', 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');
utl_http.set_header(http_req, 'Content-Type', 'application/x-www-
form-urlencoded');
utl_http.set_header(http_req, 'Content-Length',
to_char(LENGTH(t_update_send)));
utl_http.set_transfer_timeout(to_char('60'));
utl_http.set_authentication(http_req, 'nitin_pai', 'qwerty77',
'Basic');
utl_http.write_text(http_req, t_update_send);
http_resp := utl_http.get_response(http_req);
BEGIN
WHILE 1 = 1
LOOP
utl_http.read_line(http_resp, res_value, TRUE);
dbms_output.put_line(res_value);
XML_RETURN := XML_RETURN || res_value;
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
NULL;
END;
utl_http.end_response(http_resp);
END;
Thanks for your help!
-Nitin
PS: This code is sourced from http://apextoday.blogspot.com/search/label/Twitter
--
To unsubscribe, reply using "remove me" as the subject.
@Dana: The POST --> GET change worked. Thanks a lot!!
On Apr 7, 9:40 pm, Dana Contreras <d...@twitter.com> wrote:
> Change the method from POST to GET.
>
>
>
> On Wed, Apr 7, 2010 at 9:21 AM, Nitin <pai.ni...@gmail.com> wrote:
> > Hi All-
>
> > I've been trying to get read the friends timeline using Oracle PL/
> > SQL's UTL_HTTP method but for some reason it throws a "HTTP client 400
> > - Bad Request" message at line #19 - line with the get_response()
> > function. This piece of code works perfectly well for others. I'm
> > using Oracle XE. Could you please help?
>
> > DECLARE
> > http_req utl_http.req;
> > http_resp utl_http.resp;
> > t_update_send VARCHAR2(200);
> > res_value VARCHAR2(4000);
> > XML_RETURN CLOB;
> > BEGIN
> > t_update_send := '--head';
> > http_req := utl_http.begin_request('http://twitter.com/statuses/
> > friends_timeline.xml <http://twitter.com/statuses/%0Afriends_timeline.xml>',