* Search for required packages from packagist
https://packagist.org/
* Download dependent packages via composer
Composer require guzzlehttp/guzzlecomposer require league/csv
* Using composer Autoloader, write scan.php
<?php//1. Using the composer autoloader require ' vendor/autoload.php '; use guzzlehttp\requestoptions;//2. Instance guzzle http Client $client = new \guzzlehttp\client (), $options = [Requestoptions::timeout = = 3, requestoptions::D EC Ode_content = False, Requestoptions::headers = [' user-agent ' = ' mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) applewebkit/537.36 (khtml, like Gecko) chrome/67.0.3396.99 safari/537.36 ',]];//3. Open an iterative processing csv//or pass a user-defined command line parameter to specify the input file $argv [1]//$file = new Splfileobject ('. /data/t_video.csv '); /* $csvRow [4], $csvRow [5] */$file = new Splfileobject ('. /data/urls.csv '); $csv = \league\csv\reader::createfromfileobject ($file); foreach ($csv as $csvRow) {$url = $csvRow [0]; echo ' scanning ', $url, ' ... ‘; try {//4. Send HTTP Options request $httpResponse = $client->request (' GET ', $url, $options); 5. Check HTTP corresponding status code $code = $httpResponse->getstatuscode (); if ($code = = =) {echo "\033[32m[ok]\033[0m", Php_eol; } else {throw new \exception (); }} catch (\exception $e) {//6. Send the dead chain to the standard output//echo $url. Php_eol; echo "\033[31m[error]\033[0m". $e->getmessage (). Php_eol; }}
* Input CSV:
.. /data/urls.csv
Https://www.baidu.comhttps://mail.qq.com/cgi-bin/frame_html?sid=CYcBjsDbOqznWhVO&r= 375cccc57697ed7d00ae5d751663a71chttps://pan.baidu.com/disk/home?errno=0&errmsg=auth%20login%20sucess& &bduss=&ssnerror=0&traceid=#/all?vmode=list&path=%2f05.php%2f25k%20php%e9%9d%a2%e8%af%95%e8%a7 %86%e9%a2%91%e6%95%99%e7%a8%8bhttp://dict.youdao.com/w/eng/components/#keyfrom =dict2.indexhttp://php.net/ manual/en/splfileobject.fwrite.phphttps://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=2&tn= Baiduhome_pg&wd=ansi%20%e7%bb%88%e7%ab%af%e9%a2%9c%e8%89%b2%20%5b%5c33&rsv_spt=1&oq=ansi%2520%25e7 %25bb%2588%25e7%25ab%25af%25e9%25a2%259c%25e8%2589%25b2&rsv_pq=8b17bd6e0027882b&rsv_t= fcf6or2sbhi9cpu2ethdv3aqvgwsdf7ecjv7qbvjxoz3smpbem3pdnzlnrnmuow%2beowe&rqlang=cn&rsv_enter=1& inputt=2640&rsv_sug3=68&rsv_sug2=0&rsv_sug4=324354846392https://www.jb51.net/article/42358. Htmhttps://www.cnblogs.com/xudong-bupt/p/3721210.htmlhttp://www.cnblogs.com/mingzhanghui/p/9314906.htmlhttps://packagist.org/packages/maatwebsite/excelhttps:// www.phptherightway.com/#use_the_current_stable_versionhttps://doc.phpspider.org/methods.htmlhttp:// Nosuchurlhttp://deadurl
Output
* Method of outputting colored text at Linux terminal
Note echo "" To use double quotation marks, the single quotation marks will be output \033[32mxxx\033[0m
The implementation method under the shell as long as the output property is set, you can output the color of the text, some of the properties in the shell:
\033[0m Close All Properties
\033[1m Setting High brightness
\033[4m Underline
\033[5m Flashing
\033[7M Reverse Display
\033[8m blanking
\033[30m to \33[37m setting the foreground color
\033[40m to \33[47m setting the background color
\033[na the cursor to move n rows
\033[NB cursor down n rows
\033[NC cursor right shifts n rows
\033[nd cursor left n rows
\033[Y;XH Setting the cursor position
\033[2J Clear Screen
\033[k clears the contents from the cursor to the end of the line
\033[s Save Cursor position
\033[u Restore cursor Position
\033[?25l Hide Cursor
\033[?25h Display Cursor--------------------------------------------------------------------------
The colors represented by the numbers are as follows:
Word background color range: 49----
40: Black
41: Crimson
42: Green
43: Yellow
44: Blue
45: Purple
46: Dark Green
47: White
Word color: 39----
30: Black
31: Red
32: Green
33: Yellow
34: Blue
35: Purple
36: Dark Green
37: White use, such as: Echo-e "\033[34mhello, world!" (-e function is the boot setting output property), the Recovery property is the default value: Echo-e "\033[0m", a variety of similar settings can be grouped together, separated by semicolons (;). as follows: Echo-e "\033[20;1h\033[1;4;34mhello,world\033[0m"
PHP Scan URL dead link