惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
博客园 - Franky
GbyAI
GbyAI
B
Blog
WordPress大学
WordPress大学
D
Docker
小众软件
小众软件
月光博客
月光博客
博客园 - 【当耐特】
T
The Blog of Author Tim Ferriss
IT之家
IT之家
腾讯CDC
Engineering at Meta
Engineering at Meta
Vercel News
Vercel News
H
Help Net Security
M
MIT News - Artificial intelligence
L
LangChain Blog
云风的 BLOG
云风的 BLOG
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 启明星工作室

高等数学在线入门教程(零基础适配) Latex安装Texlive Authenticate an EWS application by using OAuth codemirror 高等数学课件 线性代数课件 概率论与数理统计课件 使用 Microsoft Graph oFFICE365 sendmail C# C# String 字符串转换为base64 C#语言async, await 简单介绍与实例(入门级) Microsoft.Exchange.WebServices.Data; 启明星工作室网站改版了 dotnetcms.cn 数学题库管理系统 Math 面向老师的单机版“数学系统math” 启明星Helpdesk系统,欢迎大家使用。 启明星人物评选投票系统,欢迎大家使用 微信安装包从0.5M暴涨到260M,为什么我们的程序越来越大? Kmath里MathJax和markdown整合 Windows下TeXLive 环境的安装与配置
MathPix
启明星工作室 · 2022-03-15 · via 博客园 - 启明星工作室
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Net;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string appid = "983506039_qq_com_962b1aefc";
        string appkey = "2e0b9a8a2f357d2f2901055b290c185ad56196e714bb127d4a09e4b81b7c";

       // string jsonHeard = "{\"app_id\": \""+ appid+"\", \"app_key\": \""+ appkey+"\"}";
        string url = "https://api.mathpix.com/v3/text";

        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
        request.Method = "POST";
        request.ContentType = "application/json"; 
        request.Headers.Set("app_id", appid);
        request.Headers.Set("app_key", appkey);

        string body = "{ \"src\":\"https://mathpix-ocr-examples.s3.amazonaws.com/cases_hw.jpg\", \"math_inline_delimiters\": [\"$\", \"$\"],  \"rm_spaces\": True}";

        body = "{ \"src\":\"http://www.dotnetcms.cn/1.png\", \"math_inline_delimiters\": [\"$\", \"$\"], \"math_display_delimiters\": [\"$$\", \"$$\"], \"rm_spaces\": \"true\"}";



        byte[] postBytes = null;
        postBytes = Encoding.UTF8.GetBytes(body);
        request.ContentLength = postBytes.Length;

        using (Stream reqStream = request.GetRequestStream())
        {
            reqStream.Write(postBytes, 0, postBytes.Length);
        }

        string result = string.Empty;

        using (WebResponse response = request.GetResponse())
        {
            if (response != null)
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                    {
                        result = reader.ReadToEnd();
                    }
                }

            }
        }

        Response.Write(result);

    }
}