Code snippet to retrieve real-time currency from exchangeratesapi.io
Category: PHP
[PHP+MySQL] 간단한 카카오 i 오픈빌더 챗봇 만들기 (Kakao i Open Builder)
카카오 i 오픈빌더 (Kakao i Open Builder)를 이용한 플러스 친구 챗봇 (PHP + MySQL) 백엔드 프로젝트 이 프로젝트는 샘플 테스트용으로 카카오톡 플러스 친구 챗봇을 구현하기 위해 만들어졌습니다. 이 프로젝트는 아주 기본 기능만을 구현하였습니다. Production 환경에서는 사용하기에 부족함이 많으니 참고용으로만 사용하시기 바랍니다. 테스트 커뮤니티 챗봇: http://pf.kakao.com/_vAKtj Backend API: https://kakao.chrislee.kr Backend 소스코드: https://github.com/chrisleekr/kakao-plusfriend-bot-backend 개발 환경 PHP 7.2…
Time Clock Management System developed with Yii2 REST API + Angular 2 + Docker
Time Clock Management System (Yii2 REST API + Angular 2 + Docker) Source Repo: https://github.com/chrisleekr/time-clock-management-system-yii2-rest-api-angular2-docker This is a personal project for learning Angular 2. The project contains two applications, one for REST API backend, and the another for Angular 2 frontend. The project involves: Yii2 for providing RESTful API including user login/logout, managing global…
Missing Authroization header in request
When developing REST API in Yii2, I found some development environments do not populate Authorization header in the request; as a result, I was not able to use HttpBearerAuth because the headers were missing in the request. Note that I still can use QueryParamAuth; although, I insist on using HttpBearerAuth instead of QueryParamAuth. The…
Get AWS EC2 tags to environment parameters for apache2
Objective: AWS instances are assigned tags per instance. Need tags to be environment parameters for Apache2; thus, web application can retrieve environment parameter. Step 1: Configure tags in AWS EC2 instance Step 2: Setup IAM user and get access key id and secret access key Step 3: Access to SSH and append…
PHP imap_open() error – INBOX: invalid remote specification (errflg=2)
INBOX: invalid remote specification (errflg=2) Got following error when use imap_open() in PHP? Notice: Unknown: Can’t open mailbox {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX: invalid remote specification (errflg=2) in Unknown on line 0 Check imap enabled SSL support like screenshot If cannot see SSL Support configuration, then need re-compile imap.so with enabling SSL support. PHP…
PTV Timetable API sample code for PHP
API Page: https://www.ptv.vic.gov.au/about-ptv/ptv-data-and-reports/digital-products/ptv-timetable-api/ptv-timetable-api-reference/ 1. Request API key by sending email How to register for a key and developer ID > Send an email to APIKeyRequest@ptv.vic.gov.au with the following information in the subject line of the email: • “PTV Timetable API – request for key” > Once we’ve got your email request, we’ll send you a…
Configure Aptana to support PHP 5.4
I am using Aptana Studio 3 in Mac. When I try to set PHP 5.4 environment in project settings, it does not save the changes. And found this article – http://stackoverflow.com/questions/24633995/aptana-php-version-doesnt-stick-in-project-properties 1. Open project folder 2. Create folder .settings 3. Create file com.aptana.editor.php.prefs and Put below content into created file eclipse.preferences.version=1 phpVersion=php5.4 4. Close project and re-open
Sample XAMPP MySql my.ini Fast Performance
Only use in local test MySQL. # Example MySQL config file for large systems. # # This is for a large system with memory = 512M where the system runs mainly # MySQL. # # MySQL programs look for option files in a set of # locations which depend on the deployment platform. # You…
SmartOptimizer with CS-Cart optimization
Reference: http://forum.cs-cart.com/topic/29499-speed-up-and-optimise-cs-cart-version-3/ In store root .htaccess DirectoryIndex index.html index.php <IfModule mod_rewrite.c> RewriteEngine on # Pleas note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon. # Some hostings require RewriteBase to be uncommented # Example: # Your store url is http://www.yourcompany.com/store/cart # So “RewriteBase” should be: #…
money_format_alt
Alternative code snippet for money_format function money_format_alt($amount, $decimal, $symbol = ‘$’, $symbol_right = ”, $symbol_thousands = ‘,’, $symbol_decimal = ‘.’) { if ($amount < 0) return ‘-‘.$symbol . (number_format(abs($amount), $decimal, $symbol_decimal, $symbol_thousands)) . $symbol_right; return $symbol.number_format($amount, $decimal, $symbol_decimal, $symbol_thousands).$symbol_right; }
.htaccess GZIP Compression & Enable Keep-alive
To make faster webpage loading, use Gzip compress and Enable keep-alive in htaccess <ifModule mod_deflate.c> AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript </ifModule> <ifModule mod_headers.c> Header set Connection keep-alive </ifModule> In Plesk Control Panel, follow below steps Access SSH as root user Go to /var/www/vhosts/{domain}/conf Create or Modify vhosts.conf Add following code…
To re-size images with keeping aspect ratio and fitting to certain dimensions
To re-size images with keeping aspect ratio and fitting to certain dimensions function _create_thumbnail($actual_filepath, $folder_path, $target_filename, $width, $height) { // $this->load->library(‘image_lib’); // $image_lib_config = array( // ‘image_library’ => ‘gd2’ // , ‘source_image’ => $actual_filepath // , ‘new_image’ => $folder_path.$target_filename // , ‘maintain_ratio’ => true // , ‘width’ => $width // , ‘height’ => $height //…
Draw Polygons in Google Maps and Determine whether an Address is in Polygons
Draw Polygons in Google Maps and Determine whether an Address is in Polygons This sample source code uses Google Maps Javascript API V3 to draw polygons in Google Maps. (Refer https://google-developers.appspot.com/maps/documentation/javascript/examples/drawing-tools) The address auto-complete uses Google Places Javascript library. (Refer https://developers.google.com/maps/documentation/javascript/places#places_autocomplete) The server-side code will retrieve address’ latitude and longitude using Google Gecoding API. (Refer…
네이버에서 실시간 환율 정보 받기 (Get real-time currency information from Naver)
업데이트 버젼 (Updated Version): https://chrislee.kr/wp/2020/11/21/%ec%8b%a4%ec%8b%9c%ea%b0%84-%ed%99%98%ec%9c%a8-%eb%b0%9b%ec%95%84%ec%98%a4%ea%b8%b0-get-real-time-currency-information/ 실시간 환율 정보를 받기 위해 자료를 찾아보는 중, 네이버 환율 API를 발견하였다. ( [출처] 네이버 환율정보 api 이용한 php 위젯 개발 하기 |작성자 usback]) http://www.naver.com/include/timesquare/widget/exchange.xml 여기서 의문점은 저 블로그에서 xml 주소를 열어보면, xml 정보가 보이지만 저 주소를 복사 한 뒤 볼려고 하면, 퍼미션 에러가 난다. 결론은 저 xml은 레퍼러 체크를…
PHP Proxy Script
Quoted from http://phpproxies.com/ Proxy Scripts Glype Glype is new, released just in January 2009, but it has already been downloaded 15,000 times. PHP Web Proxy This script is used for many different proxy sites, download it through SourceForge. PHPProxy Freshmeat.net’s script can turn your web host’s server into a proxy server in no time. If…
unserialize() [function.unserialize]: Error at offset 00000 of 0000 bytes
If serialize string contains ‘&’, then the error occurs when unserialize the string. unserialize() [function.unserialize]: Error at offset 00000 of 0000 bytes Simply change ‘&’ to ‘&’, by replacing it. $string = str_replace(‘&’, ‘&’, $string); $test_array = unserialize($string);