DProphet
DProphet

Reputation: 35

convert PHP into C#

i'm converting php script into c# i have everything instead of this one line

$data = array('sms_package' => json_encode(array(array('number' => $to_msisdn, 'message' => $message))), 'from' => $from_msisdn);

i was trying with JavaScriptSerializer but i'm unable to construct same arrays.

I was even trying with classes:

 public class Sms_Package
    {
        public string number;
        public string message;
    }

    public class OToSend
    {
        public Sms_Package sms_package;
        public string from;
    }

Any solution how to get this?I need to post that data into php script.

Upvotes: 1

Views: 78

Answers (1)

DProphet
DProphet

Reputation: 35

After many tries, i found it.

I used NameValueCollection with serialized Dictionary<string,Dictionar<string,string>>. Now it's passing data correctly :)

Upvotes: 1

Related Questions