Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello
can anyone help me do this , i do not know PHP and i have to do this in asp.net c#
function sign_ipn($reply, $token) {
    ksort($reply);
    $flat_reply = "";
    foreach ($reply as $key=>$value) {
        $flat_reply = $flat_reply."$key=$value&";
    }
    $flat_reply = $flat_reply."token=$token";
    return md5($flat_reply);
}

$fields = $_POST['fields'];
$data['fields'] = $fields;
$tok = strtok($fields, ",");
while ($tok !== false) {
    $data[$tok] = $_POST[$tok];
    $tok = strtok(",");
}
$mysign = sign_ipn($data, '123456');


What I have tried:

can anyone help me do this , i do not know PHP and i have to do this in asp.net c#
Posted
Updated 8-Apr-19 15:34pm
v4
Comments
#realJSOP 8-Apr-19 4:21am    
I charge $250 (US) per hour, with a minimum charge of $1000 (US). Let me know if you're interested.
Nirav Prabtani 8-Apr-19 4:50am    
:)
AtulSharma609 8-Apr-19 21:31pm    
thanks for your offer but not interested

Translating code from one language to another rarely works well, unless they share a common "philosophy" and framework, like VB and C#.

But PHP and C# are very, very different: one is an interpreted language, and the other is compiled. They do not share a framework.

Converting a (fairly poorly written) chunk of PHP isn't going to give you good C# - you would be much better off working out exactly what the PHO code is doing, and writing "real" C# code to perform the same function.
 
Share this answer
 
Comments
AtulSharma609 8-Apr-19 21:31pm    
Thanks for advise , i am doing same
private void getResponce()
{

    string requestJson = string.Empty;
    using (StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream))
    {
        requestJson = reader.ReadToEnd();
        string returnUrl = Server.UrlDecode(requestJson);
        string[] queries = returnUrl.Split('&');
        queries = queries.Take(queries.Count() - 1).ToArray();
        Array.Sort(queries);

        string sortdata = string.Join("&", queries);


        string token = "C12A68A47E1D4569A98688062F9860D0";
        string codeData = sortdata + "&token=" + token;
        string code = cla.MD5Hash(codeData);

        string singnature = Request.Form["sign"].ToString();

        if (code == singnature)
        {
            Response.Write("OK");
        }
        else { Response.Write("Failed"); }


    }

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900