自宅サーバー構築メモ。Ubuntu
2021-04-05 16:43:25 Quoinex認証をPHPで通しました。
参考にしたのはこちらですが、一部変更しないと動きませんでした。
あと、何故かLiquidでキーを再作成しなおさないと動かなかったです。
Rubyのコードと比較しながら直してできました。
$auth_payload = array(
'path'=>$order_url,
'nonce'=>$timestamp,
'token_id'=>$key
);
//$jwt = JWT::encode('path:' .$order_url,'nonce:' .$timestamp,'token_id:' .$key);
$jwt = JWT::encode($auth_payload,$secret,'HS256');
$sign = JWT::decode($jwt, $secret, array('HS256'));
$header = array(
'X-Quoine-API-Version:' . $version,
// 'X-Quoine-Auth:' . $sign,
'X-Quoine-Auth:' . $jwt,
'Content-Type:application/json',
//'Content-Length:'. strlen($body),
);
2021-04-01 18:25:56 Composerのインストール状況確認
composerインストール状況メモ。
php-phantomjsで使っていました。参考
if(PHP_OS == 'WINNT'){
define('APP', 'C:/xampp/php/');
$exepath = 'bin/phantomjs.exe';
}else{
define('APP', '/usr/local/bin/');
$exepath = 'vendor/bin/phantomjs';
}
require APP . 'vendor/autoload.php';
use JonnyW\PhantomJs\Client;
use JonnyW\PhantomJs\DependencyInjection\ServiceContainer;
use JonnyW\PhantomJs\Http\CaptureRequest;
Webのキャプチャに使っていました。
いちいちURLに全部アクセスしなくても、状態が分かるようにしていました。
例えばそのサイトが存在しているか一覧表示で分かるわけです。
vi composer.json
{
"scripts": {
"post-install-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
],
"post-update-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
]
},
"require": {
"jonnyw/php-phantomjs": "4.*"
}
}
~
この状態の所から、
composer require firebase/php-jwt
Using version ^5.2 for firebase/php-jwt
./composer.json has been updated
vi composer.json
{
"scripts": {
"post-install-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
],
"post-update-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
]
},
"require": {
"jonnyw/php-phantomjs": "4.*",
"firebase/php-jwt": "^5.2"
}
}
と言う感じで、インストールできていました。