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

  • Home
  • SEARCH
  • 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 3807076
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:56:02+00:00 2026-05-19T14:56:02+00:00

I want to have a web page (written in php because it’s what i

  • 0

I want to have a web page (written in php because it’s what i know) that displays an input value. I want that value to be passed to a c programa that’s already running.

I though of using sockets to communicate between both process, but how do I manage to do that? how can I use fsockopen to connect to a local socket.

  • 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-19T14:56:03+00:00Added an answer on May 19, 2026 at 2:56 pm

    Some simple solutions I can think of are:

    Redis

    You could use redis as your ipc using hiredis as your c client library. I never used hiredis library before but did it just now for you to test and the library is really good. I could have known it because redis is the best piece of C code I know :).

    modify example.c

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "hiredis.h"
    
    int main(void) {
        redisContext *c;
        redisReply *reply;
    
        c = redisConnect((char*)"127.0.0.1", 6379);
        if (c->err) {
            printf("Connection error: %s\n", c->errstr);
            redisFree(c);
            exit(1);
        }
    
        /* Blocking pop. */
        reply = redisCommand(c, "BLPOP php 0");
        if (reply->type == REDIS_REPLY_ARRAY) {
            if (reply->elements == 2) {
                printf("%s\n", reply->element[1]->str);
            }
        }
        freeReplyObject(reply);
        redisFree(c);
        return 0;
    }
    

    Compile and run example:

    make
    ./hiredis-example
    

    from ./redis-cli:

    from another tab start start redis-cli(for prototyping) and issue the following command. You should replace this with predis as php client library, but that is going to be very easy:

    lpush php "Hello from PHP"
    

    Inside running hiredis-example:

    You should see the message “Hello from PHP”. Easy as pie if you ask me :).

    Named pipes

    You could use a named pipes.

    Sockets

    You could read the Beej’s Guide to Network Programming Using Internet Sockets. In my opinion this is a very good read.

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

Sidebar

Related Questions

I have a text box on a web page, whose value I want to
I have a web site (written in PHP) that my users need to log
I have a web page where I want to switch the background image of
I have a web page with a bunch of links. I want to write
I have a web page. When this web page is loaded, I want to
I have a webpage that displays a calendar, and I want to change the
I have the following MySQL query that provides data to a Python web page.
I've just written (in Perl) a simple web service that displays a web form
I have a code snippet written in PHP that pulls a block of text
I have a web page which was written on ASP.NET and C#. it outputs

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.