perl script to access sec edgar master files returns file not found when file exists on ftp server -


it great if can help. stuck.

i downloading master files sec edgar , got script from—http://brage.bibsys.no/bi/bitstream/urn:nbn:no-bibsys_brage_38213/1/norli_srfe_2012.pdf (page 14..published now)

i error 404 master.gz not found while debugging made paste url , when use same in browser can download file. parsing url correctly till qtr1 after not able find file when exists ..please help.

1) debugging reasons changed code 1995 (but later plan add years 1995 2012)

2) did not work file. when said qtr1 abovr - meant same code without file name (just testing ) -- ....full-index/1995/qtr1/ (without file name) returns status code ok ...ftp.sec.gov/edgar/full-index/1995/qtr1/master.gz returns 404 file not found error. not work quarter.

i wasted time on seemingly simple thing supposed work not working.... copy past , run..is working you?

the code below gets master files qtr folders. pasting code ::

—————-

use lwp::useragent; $ua = lwp::useragent->new; $ua->timeout(250); $ua->env_proxy;  for($year=1995; $year<1996; $year=$year+1){ for($i=1; $i<5; $i=$i+1){ $quarter = “qtr” . $i; $filegrag = “ftp://ftp.sec.gov/edgar/full-index/” . $year . “/” . $quarter .       “/master.gz”; print $filegrag;  # command gets file edgar $response = $ua->get($filegrag); print $response;   print $response->status_line;  # pipe output file named appropriately $filename = $year . $quarter . “master”; open(myoutfile, “>” . $filename); if ($response->is_success)  { print myoutfile $response->decoded_content; } else { die $response->status_line; } close(myoutfile); } } 

i realized there firewall issues causing problem had. things fine.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -