PHPã§ãµã¼ãã¼ã®æ»æ´»ç®¡ç ãµã¼ãã¼ãçãã¦ããæ»ãã§ããã確èªããã®ã«Pingã使ãæ¹ã¯ããã¨æãã¾ããã ä»åPHPããPingã使ãæ¹æ³ãç¥ã£ãã®ã§èªåç¨ã«ã¡ã¢ã execã使ç¨ããæ¹æ³ãfsocketopenã使ç¨ããæ¹æ³ã®ï¼ãã¿ã¼ã³ããã¾ããã fsockeopneã使ç¨ããã¨ãã¼ãã®æå®ãåºæ¥ãã®ã§ãMySQLãApacheã稼åãã¦ãããã®ãã§ãã¯ã«ã使ãã¾ãã ã½ã¼ã¹ã³ã¼ãã¯ä»¥ä¸ execã§ãµã¼ãã¼ã«pingãéä¿¡ããæ¹æ³ /* Pingéä¿¡ããã°ã©ã */ function ping($host) { $r = exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval); //pingã®çµæã表示 //print_r($r); return $rval === 0; } /* $hostã«æ»
çµç·¯ 2015å¹´12æ2æ¥é ã«Google Feed APIãå»æ¢ããã¾ããã åã¯ããã¯Googleã®ãæ¥æ¬ã®ç¥æ¥ãã«ã¬ã³ãã¼ã®æ å ±ãåãããã«ãã®APIã使ã£ã¦ãã¾ããã ãã®ããç¥æ¥ãåå¾ããæ¹æ³ãç´¹ä»ãã¦ããããã°ã®å 容ã¯ä½¿ããªããªã£ã¦ãã¾ãã¾ããã ä¾å¤ãªã以æ¥åã§ååãæ¸ããæã¹ã¯ãªãããå»æ¢ã®å½±é¿ãåãã¦ãã¾ã£ãã®ã§å¯¾å¿ãã¾ããã æ¬ç¨¿ã¯ãã®åé¡ã«ã©ã対å¿ããã®ãã«ã¤ãã¦ã®ã¡ã¢ã§ãã ä¿®æ£ããã ã¾ãå ã«ä¿®æ£ãããã示ãã¾ãã å¤æ´å $start_time = date("Y-m-d"); $calendar_id = urlencode('japanese[email protected].google.com'); $url = "https://www.google.com/calendar/feeds/{$calendar_id}/public/basic?
mb_convert_kanaã¯å ¨è§ã»åè§å¤æãæ軽ã«ã§ãã便å©ãªé¢æ°ã ã ããããã¾ã¼ã«ãããªãã¨ããããã åå ã¯æåã³ã¼ããæå®ãã¦ããªããã¨ã«ããå ´åãå¤ãã®ã§ã mb_convert_kana($data, "K", "utf-8") ãªã©ã¨æåã³ã¼ãããã£ããæå®ãã¦ããã°åãã åºæ¬çãªãã¨ã ããæå¤ã¨å¿ããã¡ã§ããã»ã»ã»ã
æ¦è¦ HTMLã½ã¼ã¹ã«ã<meta charset="â¦" />ããæå®ãã¦ãã£ã¦ã DOMDocument::loadHTML ã¯æåã³ã¼ã解éã«å¤±æãããã¨ãããããã¨ããã話ã å®é¨å¯¾è±¡ Qiita ã®ããããã¼ã¸ãã<meta charset="UTF-8">ãã¨ããè¨è¿°ããããDOMDocument ã¯ããã解éã§ãããã«è¦ãã¾ãã <!DOCTYPE html> <html xmlns:og="http://ogp.me/ns#"> <head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script> <meta charset="UTF-8"> <title>Qiita [ãã¼ã¿] - ããã°ã©ãã®æ
åé¡ ããURLãåå¨ãããã©ããphpã§ç¢ºèªãããã çã phpã§httpã®ãªã¯ã¨ã¹ããéä¿¡ãã¦URLã«ã¢ã¯ã»ã¹å¯è½ãã©ãã確èªããæ¹æ³ã¯ããã¤ãããã ï¼ãfile_get_contents ãªã¯ã¨ã¹ãå ããªãã¨ãwarningãçºçããã®ã§@ã§æãã¦ããã $url = 'http://www.example.com/'; $response = @file_get_contents($url); if ($response !== false) { echo 'åå¨ãã'; } else { echo 'åå¨ããªã'; } ï¼ãfopen $url = 'http://www.example.com/'; $fp = @fopen($url, 'r'); if ($fp) { fclose($fp); echo 'åå¨ãã'; } else { echo 'åå¨ããªã'; } ï¼
å人çã«èªå®¶è£½botã¥ããã«èå³ãæãä»æ¥ãã®ããã ããã§æ°ã«ãªãã®ããbotã§ãµã¤ãã®å·¡åãããã®ã¯ãããã©ãHTMLã®ãã¡ã©ã®è¾ºãæ¬æã§ããã®æ¬æãä½ãæ¸ãã¦ãã£ãã®ãã¨ããã®ãã©ã®ããã«æ©æ¢°çã«åæãããã®ãï¼ ã¾ãããªãæãç©´ãããããã§ããã©ããã£ã¨èãããªãã 1.HTMLã®ä¸ã§æç« ãå¤ãããªé¨åãæ½åºã â 2.æ¥ç¶è©ãé¤å»ã㦠â 3.ã¢ã«ãã¡ãããã»ã«ã¿ã«ãã»ã²ãããªã»æ¼¢åãå¤ãã£ã¦ããã¨ããã¯å¥ã®åèªã¨ãã¦ã«ã¦ã³ãã â 4.éè¨ãã¦åèªã®æ°ãå¤ããã®ã«ã¤ãã¦ããã®ãã¼ã¸ã¯ãã®åèªã®ãã¼ãã«ã¤ãã¦èªã£ã¦ããã¨å¤æãã¦ã¿ãã ã¨ããã®ã¯ã©ãã§ãããã ããããèªåã§ã³ã¼ããèã試è¡é¯èª¤ããã®ãé¢åããããªãã ã§ããã°ãå ±æãµã¼ãã¼ãªã®ã§ãPHPä¸ã§åä½ãããªããã¤ã³ã¹ãã¼ã«ããå¿ è¦ããªãã¦ããã¨å¤é¨ãµã¼ãã¹ã¯ãããªã使ããªããªããã¨ãæãã¾ããã使ããªãã¦æ¸ããªããã£
ããã°æ¤ç´¢ã«ããã¦ãRSSã¯å¿ ãããè¨äºå ¨æãé ä¿¡ãã¦ããªãã®ã§ãã¯ãã¼ã©ã¼ãè¨äºã®URLã«ã¢ã¯ã»ã¹ãè¨äºã®æ¬æãåå¾ããã±ã¼ã¹ãå¤ãããã§ãã ãgooããã°æ¤ç´¢ããããã°ã¬ã³ã¸ã£ã¼ãéçºè ãèªãããã°æ¤ç´¢æè¡Yahoo!æ¤ç´¢ ã¹ã¿ããããã°ãYahoo!ããã°æ¤ç´¢ããç´°é¨æ¹åã®ãç¥ããä¸è¨ã®è¨äºã§ã¯ã©ã¡ããæ¬æãæ½åºãã¦ãããã¨ãã£ããæ¸ããã¦ãã¾ãã100%ã«è¿ã精度ãå®ç¾ããã¨ãªãã¨ããç°¡åã§ã¯ãªãã¯ãã ã¡ãã£ã¨èª¿ã¹ã¦ã¿ãã以ä¸ã®ãããªåãçµã¿ãè«æã¨ãã¦èªãã¾ãããè±èªåã®æç®ã¯ãæ¤ç´¢èªãæªãã£ãã®ããã¾ãã¡ããblog entry extract body text etcâ¦ã NRI æè¡åµçºãããã°è¨äºã®èªååé¡ã«ããæ¶è²»è æèã®å´é¢ãæãã試ã¿ï¼PDFï¼ãªãã§ãRSS! HTMLææ¸ããã®RSS Feed èªåçæãåéæä¹ å¥¥æå¦ï¼äººå·¥ç¥è½å¦ä¼ç 究ä¼è³æ SIG-SW
phpãã mail() ã mb_send_mail() ã§ãã¡ã¼ã«ãéãã¨ã»ã»ã» è¿·æã¡ã¼ã«ã«åé¡ãããããSPAMã¨ãã¦ãããã¯ããã¦å±ããã¨ãããªãã£ããããªããªããã¾ãããã¾ããã 確å®ã«ã¡ã¼ã«ãå±ããã«ã¯ãé¢åã§ããå®éã«ã¤ãã£ã¦ããSMTPãµã¼ãã¼çµç±ã§ã¡ã¼ã«éä¿¡ããã®ãããã£ã¨ãæå¹ãã¨ãããã¨ã§ããã®æ¹æ³ã§ãã æºå éä¿¡ç¨ã®ã¡ã¼ã«ã¢ã«ã¦ã³ããç¨æãã»ã¨ãã©ã®ãµã¼ãã¼æ¥è ã®æä¾ããSMTPãµã¼ãã¼ã¯èªè¨¼ãå¿ è¦ãªã¯ããªã®ã§ãã¡ã¼ã«ã¢ã«ã¦ã³ããä½ã£ã¦ããã Qdmail ã ãããã ãã¦ã³ãã¼ãããã Qdsmtp ã ãããã ãã¦ã³ãã¼ãããã ã³ã¼ã //Qdmailããã¼ã require_once('qdmail.php'); //Qdsmtpããã¼ã //ï¼ããã¥ã¡ã³ãã«ã¯ãè¨è¿°ä¸è¦ã¨ããã¦ããããæ¸ããªãã¨ãã¾ããããªããã¨ããã£ãï¼ require_once
PHPã§ããã°ã©ã ãããªããªæ¸ãã¦ããæ¹ãªã御åç¥ããããã¾ããããããPHPãã¡ã¤ã«ã®ããã°ã©ã ãçºãã¦ãããè¦ãªããªãä¸æãããã¾ããããã®ã½ã¼ã¹ã¯ããã $hoge = file_get_contents( 'php://input' ); ãphp://inputãã£ã¦ä½ããï¼ ä¸è¨ããã°ã©ã ã«ã¤ãã¦ã¡ãã£ã¨èª¿ã¹ã¾ãããç§ã®ããã«ç¥ããªãæ¹ã®ããã«æè¨ãã¦ããã¾ããããããç¥ã£ã¦ããæ¹ã¯ã¹ã«ã¼ãã¦ãã ãããééã£ã¦ãæªå£ãæ¸ããªãããã«(^^ã æ©ã ã«èª¿ã¹ã¦ã¿ãã¨ãã¾ãã¯file_get_contents()é¢æ°ã§ããããã¯ããã«è¦ã¤ããã¾ãããPHPã®ããã¥ã¡ã³ããè¦ãã¨ãã¡ãã« ãã¡ã¤ã«ã®å 容ãå ¨ã¦æååã«èªã¿è¾¼ã ã¨ãæ¸ããã¦ãã¾ããããã¥ã¡ã³ãå ã«ããfile()é¢æ°ã¨ä¼¼ã¦ãããã¨æ¸ããã¦ãã¾ãããfile()é¢æ°ãããåå¾ããå 容ãªã©ãç´°ããè¨å®ã§ãã¾ãã ãã¦ãåé¡ã¯ã
ããã«ã¡ã¯ãä¸å·ã§ãã PHPã§ã®éçºä¸ã®ã¡ãã£ã¨ãããããã°ã«ãecho ã var_dumpã§ç»é¢ã«å¤ãåºåãã¦ç¢ºèªãããã¨ãããã¾ãããã ãã®ãããã°æ¹æ³ã¯ç°¡åã§ããã®ã§ãããåºåããé åã®å¤ãªã©ã¯ããã¨è¦ã§ç¢ºèªããããã¨ã¯è¨ãã¾ããããç»é¢ã®è¡¨ç¤ºå 容ãå´©ããããã¾ãã ç»é¢ã«åºåããªãæ¹æ³ã¨ãã¦ã¯ã error_logé¢æ°ã使ã£ã¦apacheãã°ããã¡ã¤ã«ã«åºåããæ¹æ³ãããã¾ããã ãã®å ´åã¯ããµã¼ãå´ã«ãã°ã¤ã³ãã¦tailãªã©ã§ãã¡ã¤ã«å 容ã確èªããå¿ è¦ãã§ã¦ãã¾ãã ãããªã¡ãã£ã¨ããåé¡ã解決ãã¦ããããã¼ã« ãChrome Loggerãããç´¹ä»ãããã¨æãã¾ãã Chrome Loggerã使ãã°ãJavaScriptã®console.logã®ããã«ã 表示ç»é¢ã«ã¯å½±é¿ãä¸ããªãã§ãã©ã¦ã¶ã®ãããããã³ã³ã½ã¼ã«ã«PHPããå¤ãåºåã§ãã¾ãã â Chrome Logge
ããã¯çµæ§è¦å´ããã®ã§ããã°ã¨ãã¦æ®ãã¦ããã phpã§ãã¦ã³ãã¼ããããæ¹æ³ã調ã¹ãã¨ãã»ã¨ãã©ãreadfile()é¢æ°ã使ãã¨åºã¦ããã ã¾ããééã£ã¦ããªããã ããã©ããåã®å ´å大容éãã¡ã¤ã«ã®ãã¦ã³ãã¼ãã§ãªã«ãèããã«readfileé¢æ°ãã¤ãã£ã¦ãã¾ãããµã¼ãã¼ã¡ã¢ãªã¼é¦¬é¹¿ã¿ããã«ä½¿ç¨ãã¾ããããDiskIOè² è·ã¯10MB/s ã«ã¾ã§ãªããã§ãã¤ããç¶æ³ã«ãªã£ãã äºã®é¡æ«ã¯ãããªæãã ãã¦ã³ãã¼ãããããªã readfileé¢æ° 使ãï¼ â ã»ã¼ãOKã使ã£ã¦ã¿ããã â å®è£ ãã¦ã¿ããã§ã20MBè¶ ãããã¡ã¤ã«ããã¦ã³ãã¼ãããã¨å¤±æãããï¼ â php.iniããã¡ã¤ã«ã® post_max_size, upload_max_filesize, memory_limit ã®è¨å®ã¡ã¢ãªãå¢ããï¼ â åãã£ããå ¨é¨1GBã«è¨å®ãã¦ã¿ããã â ããæ£å¸¸ã«ã¢ããããã¦ã³ãã§
Webãµã¼ãã¼ã®ã¦ã§ãã«ã¼ã以ä¸ã«ãã¯ã©ã¹ãã¡ã¤ã«ãincludeããããã¨ãåæã¨ãªã£ã¦ããã©ã¤ãã©ãªãã¡ã¤ã«ã®ãããªç´æ¥å®è¡ããããã¨ãæå³ãã¦ããªãPHPãã¡ã¤ã«ãç½®ãã¦ãã¾ã£ãå ´åãæå³ãã¦ããªãã¦ããã©ã¦ã¶ããç´æ¥URLãå ¥åãããå ´åã¯PHPãã¡ã¤ã«ãå®è¡ããã¦ãã¾ãã¾ãã ãã¡ãããç´æ¥å®è¡ããã¦ã¯å°ããããªãã¡ã¤ã«ãã©ãããã§ãã¢ã¯ã»ã¹ã§ããå ¬éãã£ã¬ã¯ããªã«ç½®ããã¨ãééã£ã¦ãã¾ãããã¢ããªã±ã¼ã·ã§ã³è¨ç½®ãã¦ã¼ã¶ã¼èªèº«ãè¡ãå ´åã«ãããã®ãã¡ã¤ã«ã¯htdocsã®ä¸ã®ãã£ã¬ã¯ããªã«libãã£ã¬ã¯ããªãä½æãã¦...ãã¨ããæé ãä¼ããã®ãå°é£ãªå ´åãããããããã¾ããã .htaccessã§å¯¾çãã ã¨ããããã§ãç´æ¥å¼ã°ããªãããã«ããæ¹æ³ã¨ãã¦ä¸çªæåã«æãæµ®ãã¹ãã®ããã©ã¤ãã©ãªãé ç½®ãããã£ã¬ã¯ããªãå¥ã«ç¨æãã.htaccessã§denyãè¨å®ãã¦ãã¾ããã¨ã§ãã
Amazonã®WebAPIï¼Product Advertising APIï¼ãå©ç¨ãã¦æ¸ç±ãæ¤ç´¢ãã¦çµæã表示ããã ãã®åç´ãªããã°ã©ã ãPHPã¨jQueryã§ä½æããã¨ãã®ã¡ã¢ã§ãã Amazon Product Advertising APIã®ãµã³ãã«ã³ã¼ã Webãµã¼ãã¹ï¼Product Advertising API ãã¼ã¿å½¢å¼ï¼XML å©ç¨ã¬ã¤ãï¼ã©ã¤ã»ã³ã¹å¥ç´ å©ç¨æã®ç»é²ï¼å¿ è¦ Amazonã®WebAPIï¼Product Advertising APIï¼ãå©ç¨ããå ´åãã¢ã¯ã»ã¹ããããã«ããã¤ãæ¹æ³ãããããã§ãããä¸ã®ãªã³ã¯å ã®ãµã¤ãã«ããPHPã³ã¼ããå©ç¨ããã¨APIã«ã¢ã¯ã»ã¹ã§ãã¦å©ç¨ã§ãã¾ãã Sign Amazon Product Advertising API REST Requests with PHP and Python ä¸è¨ãªã³ã¯å ã«ããPHPããã°ã©ã ã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}