Referencing Previous Phalanger Variables Passed From C#
6 posts
• Page 1 of 1
Referencing Previous Phalanger Variables Passed From C#
Hi there,
I have a bit of code that runs like this in a C# class:
GetResponse and TestResult are functions written in PHP and compiled using Pure Mode Phalanger.
The variables appear to pass successfully with one issue. Within PhalangerClass.TestResult, when I scope the $response variable, the variable consists of a binary component and a string component. I wish to reference the string component of the variable as the binary component is not compatible with the TestResult function.
Is there a way to accomplish this?
Thanks!
I have a bit of code that runs like this in a C# class:
- Code: Select all
dynamic response = PhalangerClass.GetResponse(variable);
dynamic testResult = PhalangerClass.TestResult(response);
GetResponse and TestResult are functions written in PHP and compiled using Pure Mode Phalanger.
The variables appear to pass successfully with one issue. Within PhalangerClass.TestResult, when I scope the $response variable, the variable consists of a binary component and a string component. I wish to reference the string component of the variable as the binary component is not compatible with the TestResult function.
Is there a way to accomplish this?
Thanks!
- MX26
- Posts: 18
- Joined: May 14th, 2014, 4:49 pm
Re: Referencing Previous Phalanger Variables Passed From C#
What is the type of response variable?
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Referencing Previous Phalanger Variables Passed From C#
Jakub,
The response variable is a string containing HTML from a web page response. The intention is to pass the string to the next Phalanger function for a parsing operation.
The response variable is a string containing HTML from a web page response. The intention is to pass the string to the next Phalanger function for a parsing operation.
- MX26
- Posts: 18
- Joined: May 14th, 2014, 4:49 pm
Re: Referencing Previous Phalanger Variables Passed From C#
If it is a string, it is passed in the same form into the next function. Try to put watch onto the C# variable response and look on its type.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Referencing Previous Phalanger Variables Passed From C#
Jakub,
Inspection of the variables within the PHP script reveals that they are an array. The first array index contains an array of binary. The second array index contains the string that I am looking for. The names of the array indices are 'Binary' and 'String', respectively. Attempting to pass the variable's [String] index to the main C# program only yields a variable containing bytes.
Thanks.
Inspection of the variables within the PHP script reveals that they are an array. The first array index contains an array of binary. The second array index contains the string that I am looking for. The names of the array indices are 'Binary' and 'String', respectively. Attempting to pass the variable's [String] index to the main C# program only yields a variable containing bytes.
Thanks.
- MX26
- Posts: 18
- Joined: May 14th, 2014, 4:49 pm
Re: Referencing Previous Phalanger Variables Passed From C#
Easy fix. I was able to simply convert the byte array within the C# calling program by using:
string result = System.Text.Encoding.UTF8.GetString(byteArray);
Another one for the records.
string result = System.Text.Encoding.UTF8.GetString(byteArray);
Another one for the records.
- MX26
- Posts: 18
- Joined: May 14th, 2014, 4:49 pm
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests