How CURL Login with Captcha and Session
It happens because,
You took your captcha image from first getURL (ie first curl_exec)
and processed the captcha but to submit your captcha you are requested getURL (ie again curl_exec)
which means to a new page with a new captcha again.
So you are placing the old captcha and putting it in the new captcha. I'm having the same problem & resolved it.