This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'scraper.php'; | |
$scraper = new Scraper(); | |
$data = array(); | |
for ($i=1; $i<=308; $i++) { | |
$_kishi = $scraper->getKishi($i); | |
if ($_kishi) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use Goutte\Client; | |
class Scraper { | |
protected $client; | |
public function __construct() { | |
$this->client = new Client(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"birthday": "1970年9月27日(46歳)", | |
"birthplace": "埼玉県所沢市", | |
"image": "http://www.shogi.or.jp/images/player/pro/175.jpg", | |
"junni": "A級(A級以上:24期)", | |
"name": "羽生善治", | |
"no": "175", | |
"ryuou": "1組(1組以上:26期)" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use Goutte\Client; | |
class Scraper { | |
protected $client; | |
public function __construct() { | |
$this->client = new Client(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use Goutte\Client; | |
$client = new Client(); | |
$data = array(); | |
// 棋士ページをGET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ncurses をインストール | |
mkdir ~/opt && cd $_ | |
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz | |
tar zxfv ncurses-6.1.tar.gz | |
cd ncurses-6.1 | |
./configure --prefix=$HOME/local | |
make | |
make install | |
# Vim をインストール |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_wpcf7_mail_sent( $contact_form ) { | |
$message = "お問い合わせフォームが送信されました。\n"; | |
$message .= "タイトル:" . $contact_form->title; | |
my_send_linenotify( $message ); | |
} | |
add_action( 'wpcf7_mail_sent', 'my_wpcf7_mail_sent', 10, 1 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_publish_post( $ID, $post ) { | |
$message = "新規投稿が公開されました。\n"; | |
$message .= "タイトル:" . $post->post_title . "\n"; | |
$message .= "URL:" . get_permalink( $ID ); | |
my_send_linenotify( $message ); | |
} | |
add_action( 'publish_post', 'my_publish_post', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_wp_login( $user_login, $current_user ) { | |
$message = $user_login . 'がログインしました'; | |
my_send_linenotify( $message ); | |
} | |
add_action( 'wp_login', 'my_wp_login', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! function_exists( 'my_send_linenotify' ) ) { | |
function my_send_linenotify( $message, $image_thumbnail = '', $image_fullsize = '' ) { | |
$url = 'https://notify-api.line.me/api/notify'; | |
$token = '[MY_ACCESS_TOKEN]'; | |
$response = wp_remote_post( $url, array( | |
'method' => 'POST', | |
'headers' => array( | |
'Authorization' => 'Bearer '.$token, | |
), | |
'body' => array( |