C++ & PHP

This is a discussion on C++ & PHP within the C++ Programming forums, part of the General Programming Boards category; Hi! Can anybody tell me how do i link C++ & PHP. I'm making a program which should let the ...

  1. #1
    IM!
    IM! is offline
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30

    Question C++ & PHP

    Hi! Can anybody tell me how do i link C++ & PHP. I'm making a program which should let the user enter a text and then send this text as an variable (like POST in php) to a script ( ... text.php). If you know some reference, tuts, or anything about something like this please post! I don't even know if something like this is possible?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You need to write a plugin module. Its not that difficult so I'll let you google it yourself.

  3. #3
    IM!
    IM! is offline
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    plugin module ha... and you say it's not difficult... i'll give it a try!

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Its actually really not. Seriously, if you just get the source for another module, you can just more or less work backward from there. Trust me, its one of those things where you just need to find an example and you will be up and running in no time.

  5. #5
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    Why not just open the URL with the text as a variable?
    Is this not what you want? I don't fully understand.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    You might also want to look into the CGIC library. It allows you to write CGI files in C.

    Linky: http://www.boutell.com/cgic/

  7. #7
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    22
    You could try using Winsock to open a connection to the HTTP Server then POST your info to it.

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Or a HTTP library, to spare yourself the messing with sockets.

    But it is unclear what you want. To me, it sounds like the C++ program should to contact a server where a PHP script is running, passing a variable to the script, right? Or am I terribly mistaken?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    IM!
    IM! is offline
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    Yep CornedBee, thats it! The script should then write the variables in a MySQL database on the server. The PHP and MySQL part is easy, but the c++... maybe I can directly send the data with mysql++, but is it possible to send data to a database, when the program is not on the localhost, over the internet.

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Yes, that's possible, if the firewall is configured to let the connection be established (i.e. open MySQL's port), the MySQL server configured to listen on this port, to accept connections from the outside, and the user you're logging in as may log in from the outside.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    IM!
    IM! is offline
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    men I'm confused, CornedBee what do you think would be the best idea... writing a plugin module... sending it over winsock (but the programm has to work on Linux aswell)... or mysql++. Questions...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. combining c php and mysql
    By Thoth in forum C Programming
    Replies: 2
    Last Post: 01-30-2009, 10:55 AM
  2. PHP installation
    By ssharish2005 in forum Tech Board
    Replies: 8
    Last Post: 11-23-2007, 09:42 PM
  3. PHP on my Computer!
    By xxxrugby in forum Tech Board
    Replies: 4
    Last Post: 03-15-2005, 09:34 AM
  4. C++ and PHP communication
    By Korhedron in forum Game Programming
    Replies: 4
    Last Post: 01-12-2004, 06:37 AM
  5. PHP 4.3.0 released
    By codingmaster in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-30-2002, 07:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21