C# 调用demo: 实例下载


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsAppVikiApi
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string pass = HttpHelper.UrlEncode("admin的密码");
            string key = HttpHelper.UrlEncode("superadmin设置的公司的key");
            string strURL =  "http://服务器地址/webAPI/pe.php?pass=" + pass + "&key=" + key;
            string ret = HttpHelper.Post(strURL,"","");
            textBox1.Text = ret.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string userName = "test"; //公司编号
            string passWord = textBox1.Text.Trim(); //通过上面过程获取
            string model = "OnClickCall";
            string exten = "8004"; //分机
            string toTel = "1380013800"; //被叫
            string url = "http://服务器地址/webAPI/webHttpAPI.php?model=" + model + "&exten=" + exten + "&toTel=" + toTel + "&userName=" + userName + "&passWord=" + passWord;
            string ret = HttpHelper.Post(url, "", "");
            textBox2.Text = ret.ToString();
        }
    }
}