C# to PHP

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Hi zusammen,

    Ich konnte mich nicht entscheiden ob dies nun ins C# oder ins PHP gehört :) Wenns falsch ist, einfach verschieben.

    Okay, ich bräuchte folgenden C# Code in PHP übersetzt, den PHP Code selbst zu bilden ist mir ums verrecken nicht gelungen :(

    Hier der C# Code:

    Quellcode

    1. using System;
    2. using SendTextMessage.anbieter.Webservices; // import the fax web service proxy
    3. namespace SendTextMessage
    4. {
    5. class Class1
    6. {
    7. [STAThread]
    8. static void Main(string[] args)
    9. {
    10. Console.WriteLine ("Sending text message using Send operation …");
    11. // Creating data to send Fax
    12. Outbound faxData = new Outbound();
    13. faxData.CustomerID = "<your customer ID>"; // field required
    14. faxData.Password = "<your password>"; // field required
    15. faxData.Subject = "Testing Send operation";
    16. faxData.Body = "Sending text message using Send operation ...";
    17. faxData.BodyContentType ="text/plain";
    18. // Add one Recipient
    19. faxData.Recipients = new OutboundRecipient[1];
    20. faxData.Recipients[0] = new OutboundRecipient();
    21. faxData.Recipients[0].Phone = "<recipient number>"; // field required
    22. faxData.Recipients[0].Name = "<recipient name>";
    23. faxData.Recipients[0].TransactionID = Guid.NewGuid().ToString();
    24. try
    25. {
    26. FaxService serviceProxy = new FaxService();
    27. //second parameter is null to avoid advanced features.
    28. string[] transactionIDs = serviceProxy.Send(faxData, null);
    29. foreach(string transactionID in transactionIDs)
    30. {
    31. Console.WriteLine ("Fax sent. Id: {0}", transactionID);
    32. }
    33. }
    34. catch (Exception e)
    35. {
    36. Console.WriteLine ("Error {0}", e);
    37. }
    38. }
    39. }
    40. }
    Alles anzeigen


    Und hier mein PHP dazu:

    Quellcode

    1. <?php
    2. $client = new SoapClient( "http://webservices.anbieter.net/fax/1.0/faxservice.asmx?WSDL", array("trace" => 1, "exceptions" => 0));
    3. $odocdet = array
    4. (
    5. "TransferEncoding" => "base64",
    6. "FileData" => "base64",
    7. "ContentType" => "text/plain",
    8. );
    9. $odetails = array
    10. (
    11. "TransactionID" => '',
    12. "Name" => "Receipt Name",
    13. "Phone" => "49899543988xx",
    14. );
    15. $params = array
    16. (
    17. "customerID" => "490005xxx",
    18. "Password" => "xxxxxxx",
    19. "ConfirmationURL" => "mailto:matthias@anbieter.com",
    20. "CSID" => "CSID FIELD",
    21. "Sender" => "Sender Field",
    22. "Sendername" => "Sender Name",
    23. "Header" => "Header Field",
    24. "Subject" => "Subject Field",
    25. "Body" => "Body part",
    26. "BodyContentType" => "text/plain",
    27. "Resolution" => "1",
    28. "TestMode" => "true",
    29. "Recipients" => $odetails,
    30. "Documents" => $odocdet,
    31. "Date" => "1999-01-0108:08:08+01:00",
    32. "Retries" => "2"
    33. );
    34. $res = $client->Send($params);
    35. print_r($res);
    36. ?>
    Alles anzeigen


    Ich wäre wirklich sehr sehr dankbar für Hilfe. Ich gebe nicht auf bevor das läuft :) Nur weiß ich mir momentan nicht anders zu helfen als zu fragen.

    Ahjaa, hier noch die derzeitige Rückmeldung vom Webserver der den SOAP Request annimmt:

    [faultstring] => Server was unable to process request. --> Object reference not set to an instance of an object. [faultcode] => soap:Server [detail] => )

    Merci schon mal vorab,

    Matthias
    Das Leben ist binär - du bist eine 1, oder eine 0