network.request problem for yahoo money

Hi all,

    I met a problem when downloading data from yahoo money server. The server keeps replying the following messages:

Dec 28 10:26:51.613: http://tw.money.yahoo.com/fund/download/F0GBR05XE6:FO?startDate=2010%2d10%2d10&endDate=2014%2d12%2d12

Dec 28 10:26:51.759: network status:ended

Dec 28 10:26:51.759: <HTML>

<HEAD>

<TITLE>Error</TITLE>

</HEAD>

 

<BODY BGCOLOR=“white” FGCOLOR=“black”>

<H1>Error</H1>

<HR>

 

<FONT FACE=“Helvetica,Arial”><B>

Description: Could not process this request.

</B></FONT>

<HR>

</BODY>

    The code is like this:

        http_url = "http://tw.money.yahoo.com/fund/download/F0GBR05XE6:FO?startDate="…url.escape(“2010-10-10”)…"&endDate="…url.escape(“2014-12-12”)

    network.request( http_url, “GET”, networkLintener )

I’ve tried not url.escape but the situation is the same. The real url is like this:

http://tw.money.yahoo.com/fund/download/F0GBR05XE6:FO?startDate=2010-10-10&endDate=2014-12-12

I can get the data by pasting the above string to a web browser so I think it’s the url encoding issue. But after I tried long times but still no luck.

It looks like you’re url encoding the query properly.  The problem is that the service is running on HTTPS not HTTP.  You are getting a 301 redirect and it’s not handling the redirect correctly.  If you make it:  https:// then it will work as you’re expecting (and it doesn’t need to be URL encoded.  The hypens in the numbers are URL safe characters.

Rob

Yes. It works.

Thank you very much !!

It looks like you’re url encoding the query properly.  The problem is that the service is running on HTTPS not HTTP.  You are getting a 301 redirect and it’s not handling the redirect correctly.  If you make it:  https:// then it will work as you’re expecting (and it doesn’t need to be URL encoded.  The hypens in the numbers are URL safe characters.

Rob

Yes. It works.

Thank you very much !!