דחוף, זקוק לשירות API לשליחת פקס
-
קוד C# שנמצא אצלי בפרודוקשיין:
public static Tuple<string, string> Send(Func<Stream> delProc, string Number) { var req = new UploadMultiPart(); req.Files.Add(new UploadMultiPart.UploadFile("theFile", "file.pdf", delProc, "application/pdf")); req.Values.Add("email", "XXX@gmail.com"); //user req.Values.Add("password", "XXX"); //password req.Values.Add("faxNumber", Number); byte[] result = req.GetResponseBytes("https://www.myfax.co.il/action/faxUpload.do"); var response = XDocument.Parse(Encoding.UTF8.GetString(result).Substring(2)); var isError = int.Parse(response.Root.Element("RESPONSE_CODE").Value) < 0; if (isError) return Tuple.Create("שגיאה: " + response.Root.Element("RESPONSE_TEXT").Value, string.Empty); var faxCode = response.Root.Element("FAX_CODE").Value; var status = faxStatus[response.Root.Element("FAX_STATUS").Value]; return Tuple.Create(status, faxCode); }