- package.json
- bin/phpnode-server.js
- public PHP スクリプトの設置場所
グローバルコマンドとしてインストールするために次のコマンドを実行します。
npm install -g .
サーバーを起動させます。
php-node-server 8443 ./public
curl を実行してみます。
curl -k -v --data-urlencode 'emoji=🐘' https://localhost:8443/json.php
レスポンスは次のようになります。
* Host localhost:8443 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:8443...
* GnuTLS priority: NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509:-VERS-SSL3.0
* ALPN: curl offers h2,http/1.1
* SSL connection using TLS1.3 / ECDHE_RSA_AES_256_GCM_SHA384
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* error fetching CN from cert:The requested data were not available.
* common name: (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: O=mkcert development certificate,OU=masakielastic@penguin
* start date: Fri, 04 Jul 2025 17:09:25 GMT
* expire date: Mon, 04 Oct 2027 17:09:25 GMT
* issuer: O=mkcert development CA,OU=masakielastic@penguin,CN=mkcert masakielastic@penguin
* ALPN: server accepted h2
* Connected to localhost (::1) port 8443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://localhost:8443/json.php
* [HTTP/2] [1] [:method: POST]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: localhost:8443]
* [HTTP/2] [1] [:path: /json.php]
* [HTTP/2] [1] [user-agent: curl/8.13.0]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [content-length: 30]
* [HTTP/2] [1] [content-type: application/x-www-form-urlencoded]
> POST /json.php HTTP/2
> Host: localhost:8443
> User-Agent: curl/8.13.0
> Accept: */*
> Content-Length: 30
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 30 bytes
< HTTP/2 200
< date: Fri, 04 Jul 2025 18:02:04 GMT
<
* Connection #0 to host localhost left intact
{"emoji":"\ud83d\udc18"}