Git Product home page Git Product logo

fcgicli's Introduction

C++のFastCGIクライアントサンプル

https://github.com/adoy/PHP-FastCGI-Client

PHP-FastCGI-ClientのC++移植

利用方法

コンパイル

$ g++ -o fcgicli main.cpp fcg_client.cpp

コマンド

fcgcli.params["GATEWAY_INTERFACE"] = "FastCGI/1.0";
fcgcli.params["REQUEST_METHOD"]    = "PUT";
fcgcli.params["SCRIPT_FILENAME"]   = dir;
fcgcli.params["SCRIPT_FILENAME"].append("/sample.php");
fcgcli.params["SERVER_SOFTWARE"]   = "cpp/fcgi_client";
fcgcli.params["SERVER_PROTOCOL"]   = "HTTP/1.1";
fcgcli.params["CONTENT_TYPE"]      = "application/x-www-form-urlencoded";
fcgcli.params["CONTENT_LENGTH"]    = conlength.str();

fcgcli.params["Original-Key"] = "originkey";

response = fcgcli.request(contents);

cout << response << endl;

テスト実行

$ ./fcgicli
X-Powered-By: PHP/5.4.19-1~dotdeb.0
Set-Cookie: sheepsid=tlr88p6vsrva4c4njjomi0ajl6; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
values
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Array
(
    [USER] => www-data
    [HOME] => /var/www
    [FCGI_ROLE] => RESPONDER
    [CONTENT_LENGTH] => 6
    [CONTENT_TYPE] => application/x-www-form-urlencoded
    [GATEWAY_INTERFACE] => FastCGI/1.0
    [Original-Key] => originkey
    [REQUEST_METHOD] => PUT
    [SCRIPT_FILENAME] => /home/yujiro3/fcgicli/sample.php
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_SOFTWARE] => cpp/fcgi_client
    [PHP_SELF] =>
    [REQUEST_TIME_FLOAT] => 1384176807.6554
    [REQUEST_TIME] => 1384176807
)

ライセンス

Copyright © 2013 Yujiro Takahashi
Licensed under the MIT License.
Distributed under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.