C# curl没有显示验证码

C# curl没有显示验证码,c#,regex,curl,http-post,libcurl,C#,Regex,Curl,Http Post,Libcurl,我正在为一家公司创建一个应用程序,该公司将在windows应用程序中填写表单,并向服务器发送一个post请求以注册用户 为了发送POST请求,我使用了curl private void post_data(string url, string data) { Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL); Easy e = new Easy(); Easy.WriteFunc

我正在为一家公司创建一个应用程序,该公司将在windows应用程序中填写表单,并向服务器发送一个post请求以注册用户

为了发送POST请求,我使用了curl

    private void post_data(string url, string data)
    {
        Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

        Easy e = new Easy();
        Easy.WriteFunction wf = MyWriteFunction;

        e.SetOpt(CURLoption.CURLOPT_URL, url);
        e.SetOpt(CURLoption.CURLOPT_POSTFIELDS, data);
        e.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
        e.Perform();
        e.Cleanup();
    }

    private int MyWriteFunction(byte[] buf, int size, int nmemb, Object extraData)
    {
        StreamWriter sw = new StreamWriter(@"curl.txt");

        foreach (byte b in buf)
        {
            sw.Write(((char)b));
        }
        sw.Flush();
        sw.Close();

        return buf.Length;
    }
为了从源代码中提取Captcha图像路径,并让用户键入文本

    private void Get_Captcha_Image(string url)
    {
        Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

        Easy e = new Easy();
        Easy.WriteFunction wf = MyWriteFunction;
        e.SetOpt(CURLoption.CURLOPT_URL, url);
        e.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
        e.Perform();
        e.Cleanup();

        get_ca_2();
    }

    private void get_ca_2()
    {
        Regex r = new Regex(@"(?<=src=('|""))https?://.*?(?=\1)");

        foreach (string line in File.ReadAllLines("curl.txt"))
        {
            Match m = r.Match(line);

            if (m.Success)
            {
                if (m.Value.Contains("http://www.google.com/recaptcha/api/image?c="))
                {
                    pictureBox1.ImageLocation = m.Value;
                }
            }
        }
    }
private void获取验证码图像(字符串url)
{
GlobalInit((int)CURLinitFlag.Curl\u GLOBAL\u ALL);
Easy e=新的Easy();
Easy.WriteFunction wf=MyWriteFunction;
e、 SetOpt(curlpoption.curlpopt_URL,URL);
e、 SetOpt(curlpoption.curlpopt_WRITEFUNCTION,wf);
e、 执行();
e、 清理();
获取_ca_2();
}
私有void get_ca_2()
{

正则表达式r=新正则表达式(@“(?我会调查网站内容是否会根据您的标题发生变化。很明显,curl的标题看起来与(比如)的标题非常不同。尝试使用允许您伪造不同用户代理的浏览器,等等,看看这是否会改变。这可能与使用curl的--user-agent标志一样简单

<img width="300" height="57" src="http://www.google.com/recaptcha/api/image?c=03AHJ_VuvnenuZSRbfL_JTQLTYKFYzEFTkYrDgedu0SLyYvTDhsr2hHjQPwYlGJiP3dJRewkIhhdeILAd1_61_aFfU2dclbf8uovme-0gF3nm8Y7-LQVfaDQoI35bo3c35pOnF-xSY3Qfy_lh8TzhSWlMemEnkYnDpZw" alt="reCAPTCHA challenge image" style="display:block;">