投稿関連
ページID 取得・表示
[php]<?php $post_id = get_the_ID ( ) ;
echo $post_id; ?>[/php]
リンク取得・表示
[php]
<a href="<?php echo get_permalink( 99 ); ?>">リンクテキスト</a>
[/php]
…
使い方
ip2location.io使い方は簡単で、上記サイトに無料アカウント登録し、API KEYを取得します。
API KEYと情報を取得したいIPをパラメータに設定して、
以下のURLにアクセスすれば、情報が取得できます。
https://api.ip2location.io/?ip=218.42.223.17&key=【API KEY】&ip=【IP】&format=json
PHPで配列に変換
//IP2Location.io APIの設定
$arg= array( 'key' => '************',
'ip' => '123.456.789.**'
);
$json_url = "https://api.ip2location.io/?ip=218.42.223.17&key=【API KEY】&ip=【IP】&format=json";
$json = file_get_contents( $json_url );
//配列を表示
print_r($json);
graffiti on the web
この投稿へのコメント
コメントはまだありません。