# \[ruby & win xp\] Captha problem

**URL:** <https://www.ruby-forum.com/t/ruby-win-xp-captha-problem/144575>\
**Category:** Ruby\
**Created:** [July 31, 2008, 4:00am UTC](https://www.ruby-forum.com/t/ruby-win-xp-captha-problem/144575 "2008-07-31T04:00:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![riv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a9a28c/32.png) [@riv](https://www.ruby-forum.com/u/riv)\
**Post date:** [July 31, 2008, 4:00am UTC](https://www.ruby-forum.com/t/ruby-win-xp-captha-problem/144575/1 "2008-07-31T04:00:34Z")

</div>

Hello, I have created small application which has to log me in onto  
forum. Login form has also php generated token. Im using hpricot &  
mechanize & captha to hadle this form. My problem is: when captha  
download token to my hdd, i cannot open it and read letters from image.  
I encouter info dialog that png image is broken and unreadable.

my code, to hadle token download:

captha\_image = quest\_get(CAPTHAURL + rand.to\_s)

captha\_file = File.open(“captha.png”, ‘w’)  
captha\_file.write captha\_image.body  
captha\_file.close

thank You for interesting - any idea how to solve this one?  
Kyle
