C#.NETアプリケーションでWHMCS APIを使用します
質問
私はC#.NETのクラスを始めたばかりで、それがどれほどシンプルであるかが本当に魅力的であることがわかりました。私は何年もC ++を使用してきたので、単純な性質が実際にやや混乱していると私を襲っています。
これらの線に沿って何かをしたいのですが...
http://wiki.whmcs.com/api:example_usage
C#.NETアプリケーションからこれを行うのは簡単ですか、それともC ++とほぼ同じボートにいます(Libcurlを構築し、他のLIBSの束をつかむなど)?
解決
作成してインスタンスを作成できます webclient したがって:
// Instantiate the WebClient object
WebClient WHMCSclient = new WebClient();
// Prepare a Name/Value collection to hold the post values
NameValueCollection form = new NameValueCollection();
form.Add("username", username);
form.Add("password", password); // the password will still need encoding is MD5 is a requirement
form.Add("action", "addinvoicepayment"); // action performed by the API:Functions
form.Add("invoiceid", "1");
form.Add("transid", "TEST");
form.Add("gateway", "mailin");
// Post the data and read the response
Byte[] responseData = WHMCSclient.UploadValues("http://www.yourdomain.com/whmcs/includes/api.php", form);
// Decode and display the response.
Console.WriteLine("\nResponse received was \n{0}",Encoding.ASCII.GetString(responseData));
私はそれをテストする機会がありませんでしたが、このスニペットは少なくともあなたが正しい線に沿って作業しているはずです。
所属していません StackOverflow