2

I recently got a project which require communication between php and .Net websites.

The developer form php didnt provide much doc about their code, only a client site library and a small piece of sample code.

// initialize the form parameters from the data provided in the url
$paramDataLen = (int) $_GET['paramdatalen'];
$paramData = base64_decode($_GET['paramdata']);
$paramData = gzuncompress($paramData, $paramDataLen);
$paramArray = unserialize($paramData);

How can i convert code above into C# and use in .NET?

I saw post of this How to unserialize PHP Serialized array/variable/class and return suitable object in C#, however since i have no php experience before, would be good if some one can point me a right direction to do this, whith few more details about how a .net guy dealing with php

I am finding a hard time in converting php code into C# there is another function which i am scraching my head.

mcrypt_decrypt(MCRYPT_BLOWFISH, $config['DATAAPISECRETKEY'], $result, MCRYPT_MODE_CBC, $encryptedData['iv']);

is there any equivalent code/lib available in c#?

Community
  • 1
  • 1
D.J
  • 2,534
  • 4
  • 28
  • 43
  • You find all PHP functions documented in the PHP manual: http://php.net/docs – hakre Nov 18 '11 at 00:29
  • I end up using http://stackoverflow.com/questions/1914585/how-to-unserialize-php-serialized-array-variable-class-and-return-suitable-objec, and it really worked after a few tweeks. – D.J Nov 23 '11 at 04:58
  • D.J. would be cool if you leave some notes in form of an answer how you tweaked / solved it, so you have documented this and others can find it. – hakre Nov 23 '11 at 08:20

1 Answers1

0

You can transport your object as json.

To facilitate, use Json.NET library.

Nightfirecat
  • 11,432
  • 6
  • 35
  • 51
Gus
  • 856
  • 1
  • 8
  • 24
  • thanks for the answer, sending Json out no problem. however since we have no control of the php code neither development. the difficulties for now is how can i consume data from php. – D.J Nov 18 '11 at 00:07