Integrating VC++ and PHP

Discussion in 'Open Source' started by bukaida, Nov 26, 2006.

Thread Status:
Not open for further replies.
  1. bukaida

    bukaida New Member

    Joined:
    Jul 21, 2005
    Messages:
    326
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    KOLKATA
    I have a program written in VC++. Is it possible to design any interface between them, like taking the input and displaying the output in php and the processing is done in the VC++ module? Please help. Do I need to convert the VC++ module to php?
     
  2. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    Though I never tried it, I think it can be done! PHP is server side scripting language. So u need to enable local web server integrated with php. I don't know much about VC++ coz I used it only 2-3 times. So if u can display the output of the html code, then ofcors u can display for php code too!
     
  3. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    You will have to use file open, file close functions.

    Make VC++ application write to a file. Keep the file name fixed or at least devise a logic to name it. Make PHP open that file, read the contents and process it the way you want.

    But I have not clearly understood what you want to do. Please explain properly.
     
  4. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,726
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    @Tuxfan, what he wants to do is this;

    Take Input from PHP -> Do Processing in VC++-> Display output in PHP!!!


    @Bukaida, Yeah, it can be done. Save the input contents in a database or file. Read the file
    contents/ database in VC++ & do the processing in VC++. Now store the output
    of the processing in another file. Read this file & show the output in PHP!!
     
  5. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    What do you mean by "Display output in PHP"? You mean, he wants to generate PHP code through his VC++? Then he has to simply use fopen (or fileopen or some similar command) and write a file!
     
  6. OP
    OP
    bukaida

    bukaida New Member

    Joined:
    Jul 21, 2005
    Messages:
    326
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    KOLKATA
    ok, ok . I must explain the problem in greater details.Can I send an image like this? Actualy my OCR program is written in VC++ and The image is residing in another machine where the output is to be returned. Can I do it by the method mentioned by you? There is not much information about this in php manual.BTY I am using php4.4.0 with GD library support under apache 2.
    The OCR software we are using requires huge amount of memory and processing power which a client machine cannot have.Moreover we want to provide it as a service rather than delivering the entire software to the client. It is a part of the e-Governance program, so they want to keep the main program with themselves. Can it be done with webservice or any other better way, I mean any other serverside scripting with java script support?
     
  7. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,726
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    @Bukaida, Yeah, it can be done. Read the Image file using the OCR program written
    in VC++. Save the image file as JPEG or PNG on the disk. Now use the PHP script to
    display the image file to the client. The entire processing is done on the Server-side.
    You can do it using PHP or Servlets or .NET.
     
  8. OP
    OP
    bukaida

    bukaida New Member

    Joined:
    Jul 21, 2005
    Messages:
    326
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    KOLKATA
    @JGuru: The image is in the client's machine and the ocr is on the server. So I cannot directly read it. If somehow I can do it , it will solve my 75% problem.
     
  9. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,726
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    @Bukaida, First transfer the Image (copy) to the Server , do the the processing on the
    Server & transfer the Image back to the client. So do you have a single Image or series of Images?
    You have to write a FTP program that transfers the file from the client to the Server.
    Use the same program to transfer the Image back to the client after the processing
    is done. From my view point Servlets will be more suitable for this kind of Project. Also
    you can write a FTP program using JAVA API.
     
  10. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    This is my understanding. Correct me if I am wrong:

    1. You transfer image from machine A to machine B which has VC++ module for OCR.
    2. It returns you "TEXT".
    3. You want to use PHP module on machine B to display that text.

    If this is true then you will have to transfer a file thru FTP from one machine to another. There's no other way :(

    If your PHP module waits for input from VC++ module, it could sometime create problems because they are two different machines and therefore connectivity quality depends on a lot of factors. So you may have to set up a cron job to automatically keep checking for existence of OCRed text file and then email.

    The VC++ module can directly generate the code with the required HTML tags and so the PHP module can simply use the print() function.

    But if I know more about the real application and its needs I may be able to give some more suggestion which are a bit more appropriate.

    UPDATE:
    This one more thought has come to my mind.

    You can keep a database on the machine with PHP. VC++ module may remotely connect to the database from the other machine and update it.
     
  11. OP
    OP
    bukaida

    bukaida New Member

    Joined:
    Jul 21, 2005
    Messages:
    326
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    KOLKATA
    @tuxfan and JGuru: Actualy the client server interface should be browser based. So that the client can just type the address of the server and do the processing. Since the scanned tiff file will be at the order of 20-25mb, it will not be possible to transfer the entire image through ftp.Also any lossy compression like jpeg cannot be applied at the client end as it will drasticaly reduce the ocr readability.So the client must select some area of the image to be transmitted preferably through browser(with java script).So this is the scenario.
     
  12. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    If the file is too big to be transferred then you will have to have all things on the same server. I am afraid, you don't have too many options in this! :( If its on the same server than you can do what I said in my first post at this thread.
     
Thread Status:
Not open for further replies.

Share This Page