Home >Backend Development >PHP Tutorial >Example of using jsoup to extract all links from HTML

Example of using jsoup to extract all links from HTML

WBOY
WBOYOriginal
2016-07-25 09:08:051278browse
The byte-order mark (BOM) is the Unicode character ("zero-width non-breaking whitespace") located at the code point U+FEFF. This character is used to indicate the byte order when encoding a string of UCS/Unicode characters as UTF-16 or UTF-32. It is often used as a marker to indicate that a file is encoded in UTF-8, UTF-16, or UTF-32.
  1. class encryption {
  2. function en($str,$key) {
  3. $ret='';
  4. $str = base64_encode ($str);
  5. for ($i=0; $i< ;=strlen($str)-1; $i++){
  6. $d_str=substr($str, $i, 1);
  7. $int =ord($d_str);
  8. $int=$int^$key;
  9. $hex=strtoupper(dechex($int));
  10. $ret.=$hex;
  11. }
  12. return $ret;
  13. }
  14. function de($str,$key) {
  15. $ret='';
  16. for ($i=0; $i<=strlen($str)-1; 0){
  17. $hex=substr($str, $i, 2);
  18. $dec=hexdec($hex);
  19. $dec= $dec^$key;
  20. $ret.=chr($dec);
  21. $i=$i+2;
  22. }
  23. return base64_decode($ret);
  24. }
  25. }
  26. $cryption=new encryption;
  27. ?>
Copy code
  1. /*
  2. * Created on 2012-3-23
  3. *
  4. * To change the template for this generated file go to
  5. * Window - Preferences - PHPeclipse - PHP - Code Templates
  6. */
  7. $content = '
    ';
  8. preg_match('/]*src=["']Butt[/]?(.+?)["']Butt[^>]* >/si', $content, $matches);
  9. print_r($matches);
  10. echo '
    ';
  11. preg_match('/]*src=[ "']Butt[/]?(.+?)["']Butt[^>]*>/si', $content, $matches);
  12. print_r($matches);
  13. define( 'HTTP_PATH','http://'.$_SERVER['HTTP_HOST']);
  14. $img = getimagesize(HTTP_PATH.$matches[1]);
  15. print_r($img);
  16. mb_internal_encoding('UTF-8 ');
  17. $a = 'I love youI love you';
  18. echo mb_strlen($a);
  19. echo '
    ';
  20. echo mb_substr($a,1,2);
  21. ?>
Copy code
  1. // +---------------------------------------- --------------------------------
  2. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  3. // + -------------------------------------------------- --------------------
  4. // | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
  5. // +------ -------------------------------------------------- ---------------
  6. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  7. // +---------- -------------------------------------------------- ----------
  8. // | Author: liu21st
  9. // +--------------------- --------------------------------------------------
  10. //Define the ThinkPHP framework path
  11. define('THINK_PATH', 'ThinkPHP');
  12. //Define the project name and path
  13. define('APP_NAME', 'Home');
  14. define('APP_PATH', 'Home' );
  15. define('NO_CACHE_RUNTIME', true);
  16. //define('RUNTIME_ALLINONE', true);
  17. // Load the framework entry file
  18. require(THINK_PATH."/ThinkPHP.php");
  19. //Instantiate a website application instance
  20. App::run();
  21. ?>
Copy code
Example of using jsoup to extract all links from HTML


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn