在 Pastie 或 C# 中的 Pastebin 上提交帖子

发布于 2024-08-16 08:16:00 字数 93 浏览 2 评论 0原文

我正在寻找一种从我的 C# 应用程序中向 Pastie.org 或 Pastebin.com 提交帖子的方法,我知道我必须使用某种 http 帖子,但我正在寻找具体的示例。

I'm looking for a way to submit a post to pastie.org, or pastebin.com from within my C# app, i know ill have to use some sort of http post but im looking for specific examples..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

囚你心 2024-08-23 08:16:00

我刚刚用 C# 编写了一个简单的 PasteBin 客户端

您可以按如下方式使用它:

        string apiKey = "<your api key>";
        var client = new PasteBinClient(apiKey);

        // Optional; will publish as a guest if not logged in
        client.Login(userName, password);

        var entry = new PasteBinEntry
            {
                Title = "PasteBin client test",
                Text = "Console.WriteLine(\"Hello PasteBin\");",
                Expiration = PasteBinExpiration.OneDay,
                Private = true,
                Format = "csharp"
            };

        string pasteUrl = client.Paste(entry);
        Console.WriteLine("Your paste is published at this URL: " + pasteUrl);

您可以在 上获取您的 API 密钥此页面(您需要登录)。

I just wrote a simple PasteBin client in C#.

You can use it as follows:

        string apiKey = "<your api key>";
        var client = new PasteBinClient(apiKey);

        // Optional; will publish as a guest if not logged in
        client.Login(userName, password);

        var entry = new PasteBinEntry
            {
                Title = "PasteBin client test",
                Text = "Console.WriteLine(\"Hello PasteBin\");",
                Expiration = PasteBinExpiration.OneDay,
                Private = true,
                Format = "csharp"
            };

        string pasteUrl = client.Paste(entry);
        Console.WriteLine("Your paste is published at this URL: " + pasteUrl);

You can obtain your API key on this page (you need to be logged in).

つ低調成傷 2024-08-23 08:16:00

使用浏览器发布示例代码/文本并拦截数据并找出答案时,可能值得您花时间检查和监视 HTTP GET/POST。使用 WiresharkHTTPWatch。这应该能让您了解 HTTP 的 POST 中的预期内容。您需要将 HTTP 标头中的内容长度设置为所提交代码的实际长度,看看 这里此处此处< /a>.

祝您2010年快乐、平安。
希望这有帮助,

It might be worth your while to check and monitor the HTTP GET/POST's when using your browser to post sample code/text and intercept the data and find out..Use Wireshark or HTTPWatch. This should give you an idea on what is expected in the HTTP's POST. You would need to set the content-length in the HTTP header to the actual length of the code being submitted, have a look here and here and here.

Wishing you a happy and peaceful 2010.
Hope this helps,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文