I'm a bit nervous about this.  There's no indication in the function name or comment that this method must be called in the same context as the previous request.  I think you should either make this very clear, require curl to be passed in or perform this response code query outside this method and pass the HTTP code in.