Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 798095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:54:57+00:00 2026-05-14T22:54:57+00:00

I work for a company that makes application’s in C#. recently we got a

  • 0

I work for a company that makes application’s in C#.
recently we got a customer asking us to look in to rebuilding an application written in PHP.
This application receives GPS data from car mounted boxes and processes that into workable information.

The manufacturer for the GPS device has a PHP class that parses the received information and extracts coordinates. We were looking in to rewriting the PHP class to a C# class so we can use it and adapt it. And here it comes, on the manufacturers website there is a singel line of text that got my skin krawling:

“The encoding format and contents of the transmitted data are subject to constant changes.
This is caused by implementations of additional features by new module firmware versions which makes it virtually impossible to document it and for you to properly decode it yourself.”

So i am now looking for a option to use the “constantly changing” PHP class and access it in C#. Some thing link a shell only exposing some function’s i need. Except i have no idea how i can do this. Can any one help me find a solution for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:54:58+00:00Added an answer on May 14, 2026 at 10:54 pm

    I know it’s a really hacky solution, but if you need a bit of PHP code that you don’t want to have to repeatedly port to C# each time, you could try the following approach, although it means that you would need the php command line tool on the target machine.

    First step is to have a php script that continously reads data off stdin, decodes it using this special class from the vendor, and writes the result out to stdout. Really simple example:

    <?php
    
    include("VendorDecodingClass.php");
    
    while(true) 
    {
        $input = fgets(STDIN); //read off of the stdin stream
    
        //can't remember if this is valid, but somehow check that there is some data
        if($input) 
        {
             //pass it off to the vendor decoding class
             $output = VendorDecoding::decode($input);    
    
             fwrite(STDOUT, $output); //write the results back out
        }
        //sleep here so you don't suck up CPU like crazy 
        //(1 second may be a bit long tho, may want usleep)
        //Edit: From Tom Haigh, fgets will block, so the sleep isn't necessary
        //sleep(1); 
    }
    
    ?>
    

    Anyway, once you have that in place, in your C# application, right at the start, create a new Process to run that script and then save the Process instance somewhere, so you can reference the STDIN and STDOUT at a later point. Example:

    ProcessStartInfo procStartInfo = new ProcessStartInfo("php", "yourscript.php");
    procStartInfo.RedirectStandardOutput = true;
    procStartInfo.UseShellExecute = false;
    procStartInfo.CreateNoWindow = true;
    
    Process proc = new Process(); //store this variable somewhere
    proc.StartInfo = procStartInfo;
    proc.Start();
    

    Then, when you want to decode your data, you just write to the stdin of the php process you created, and wait for a response on the stdout. Using the stdin/stdout approach is a lot more efficient than creating a new process each time you want to decode some data, because the overhead of creating that process can be noticeable.

    proc.StandardInput.WriteLine(somedata); //somedata is whatever you want to decode
    
    //may need to wait here, or perhaps catch an exception on the next line?
    
    String result = proc.StandardOutput.ReadLine();
    
    //now result should contain the result of the decoding process
    

    Disclaimer here, I haven’t tested any of this code, but that is the general gist of how I might do it.

    Something else I just thought of, you will want some mechanism for terminating that PHP process. It may be OK to use Process.Kill, but if the decoding does any file IO, or anything critical you may want to send an interrupt signal to the php script somehow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The company I work for makes hardware that communicates to the computer though a
The company that I work for develops a C++ application to manage service businesses
I work at a company that has some very non-standardized SQL conventions (They were
I currently work at a company that has a lot of custom applications that
In the company that i work, we develop all the GUI in C#, but
Just to preface: I work in a small company that does ASP.NET development and
I'm working on a document wizard for the company that I work for. It's
At the company I work for we have a Utility project that is referenced
I work for a small web development company (only 2 to 3 developers) that
I have a requirement to build an application that a company can use to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.