当前位置:   article > 正文

火车头伪原创php-火车头采集伪原创插件

火车头伪原创

火车头伪原创php是基于小发猫伪原创工具基于人工智能(AI)大数据深度伪原创算法,使用神经网络算法,在超过1,535,000篇文章中进行自动学习、聚合算法进行人工智能编写,既不更改内容的语义,火车头采集伪原创插件又能生成通过自媒体平台原创检测和搜索引擎收录。

为什么什么是PHP?英文php兼容性好啊,什么系统都能运行。PHP,全称 Hypertext Preprocessor ,中文翻译“超文本预处理器”。在PHP的官网是这样介绍PHP的:

PHP is a popular general-purpose scripting language that is especially suited to web development.

Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.

火车头伪原创php源码:

  1. <?php
  2. set_time_limit(270);
  3. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  4. define('TITLE_SEPAR', 'xxx**xxx');
  5. define('TITLE_SEPAR2', '262661');
  6. $url = 'http://api.xiaofamao.com/api.php?json=0&v=1&key=abc';
  7. $content_tag_name = '内容';
  8. $headdd = '';
  9. $taill = '';
  10. switch($LabelArray['PageType'])
  11. {
  12. case 'List'://处理列表页,只能处理html
  13. break;
  14. case 'Pages'://处理多页,只能处理html
  15. break;
  16. case 'Content'://处理默认页,只能处理html
  17. break;
  18. case 'Save'://只有保存时是可以处理标签值的
  19. // 保存原文
  20. try {
  21. /**********************************************************************/
  22. // 这一步用来获取伪原创文章
  23. /**********************************************************************/
  24. $content = $LabelArray[$content_tag_name];
  25. $content_wyc = curl_request($url, array('wenzhang'=>$LabelArray[$content_tag_name] ));
  26. $content_wyc = fix_newline($content_wyc);
  27. $content_wyc = str_replace('标签:', '标签:', $content_wyc);
  28. $LabelArray[$content_tag_name] = $headdd. $content_wyc. $taill;
  29. $LabelArray['标题'] = get_ai_title2($LabelArray['标题']);
  30. }
  31. catch (Exception $e) {
  32. $LabelArray['标题'] .= $e->getMessage();
  33. $LabelArray[$content_tag_name] .= $e->getMessage();
  34. }
  35. break;
  36. default:
  37. //$LabelArray[$content_tag_name]=curl_request($url, array('wenzhang'=>$LabelArray[$content_tag_name] ));
  38. }
  39. echo serialize($LabelArray);
  40. function get_ai_title2($title) {
  41. $title = urlencode($title);
  42. #$url = 'http://nlp.78tp.com/aititle2/title.php?v=2&key=zpbflh&title='.$title;
  43. $title_ai = curl_request($url);
  44. switch(rand(0, 3)) {
  45. case 0:
  46. $title_ai = str_replace(array('(', ')'), array('(', ')'), $title_ai);
  47. break;
  48. case 1:
  49. $title_ai = str_replace(array('(', ')'), array(',', ''), $title_ai);
  50. break;
  51. case 2:
  52. $title_ai = str_replace(array('(', ')'), array('_', ''), $title_ai);
  53. break;
  54. case 3:
  55. $title_ai = str_replace(array('(', ')'), array('一', ''), $title_ai);
  56. break;
  57. }
  58. return $title_ai;
  59. }
  60. function compose_article($title, $content) {
  61. $separator = compose_separator();
  62. return $title.$separator.$content;
  63. }
  64. function compose_separator() {
  65. return PHP_EOL.'('.TITLE_SEPAR2.')'.PHP_EOL;
  66. }
  67. function fix_separator($article) {
  68. return $article;
  69. }
  70. function get_wyc_article($str) {
  71. global $url;
  72. $separator = compose_separator();
  73. $separator = str_replace(PHP_EOL, '', $separator);
  74. $wyc = curl_request($url, array('wenzhang'=>$str));
  75. $wyc_f = $wyc;
  76. $wyc = fix_separator($wyc);
  77. $wyc = explode($separator, $wyc);
  78. if (isset($wyc[0])){
  79. $wyc[0] = str_replace('标题:', '', $wyc[0]);
  80. $wyc[0] = str_replace('标题:', '', $wyc[0]);
  81. $wyc[0] = str_replace('目:', '', $wyc[0]);
  82. $wyc[0] = str_replace('目:', '', $wyc[0]);
  83. $wyc[0] = 'xx`xx'.$wyc[0];
  84. $wyc[0] = str_replace('xx`xx题', '', $wyc[0]);
  85. $wyc[0] = str_replace('xx`xx', '', $wyc[0]);
  86. }
  87. //if (isset($wyc[1])) $wyc[1] = trim($wyc[1]);
  88. //$wyc[1] = $wyc_f.'jjjjjjjj'.$wyc[1];
  89. return $wyc;
  90. }
  91. function get_wyc_title($str) {
  92. $title = get_wyc_article($str.PHP_EOL.PHP_EOL.PHP_EOL.$str.PHP_EOL.PHP_EOL.PHP_EOL.$str);
  93. $title = fix_newline($title);
  94. $title = explode(PHP_EOL, $title);
  95. return $title[0];
  96. }
  97. function get_keywords($title, $contents) {
  98. $kws = curl_request($url_kw, array(
  99. 'title'=>$title,
  100. 'len'=>100,
  101. 'text'=>$contents));
  102. return $kws;
  103. }
  104. function remove_alt($contents) {
  105. $contents = preg_replace('/alt=\"(.*)\"/', '', $contents);
  106. return $contents;
  107. }
  108. function fix_title($contents) {
  109. $punctuation_symbol = array('。', '?', ',', ':', ';', '、', '!',
  110. '.', '?', ',', ':', ';', '!');
  111. $contents = str_replace($punctuation_symbol, '', $contents);
  112. return $contents;
  113. }
  114. function br2newline($contents) {
  115. $contents = str_replace('<br>', PHP_EOL, $contents);
  116. $contents = str_replace('<br/>', PHP_EOL, $contents);
  117. $contents = str_replace('<br />', PHP_EOL, $contents);
  118. $contents = str_replace('<BR/>', PHP_EOL, $contents);
  119. $contents = str_replace('<BR>', PHP_EOL, $contents);
  120. $contents = str_replace('<BR />', PHP_EOL, $contents);
  121. return $contents;
  122. }
  123. function newline2br($contnets) {
  124. $contnets = str_replace(PHP_EOL, "<br>", $contnets);
  125. // $contnets = str_replace('><br><', '><', $contnets);
  126. $contnets = str_replace('<p><br>', '<p>', $contnets);
  127. return $contnets;
  128. }
  129. function delete_newline($contents) {
  130. $contents = fix_newline($contents);
  131. // $contents = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $contents);
  132. // $contents = str_replace('>'.PHP_EOL, '>', $contents);
  133. return $contents;
  134. }
  135. function reset_newline_win($contents) {
  136. // 优化换行符
  137. $contents = str_replace("\r\n", "\n", $contents);
  138. $contents = str_replace("\r", "\n", $contents);
  139. $contents = str_replace("\n", PHP_EOL, $contents);
  140. return $contents;
  141. }
  142. function fix_newline($data) {
  143. $data = str_replace("\r", "\n", $data);
  144. while(strpos($data, "\n\n") !== false) {
  145. $data = str_replace("\n\n", "\n", $data);
  146. }
  147. $data = str_replace("\n", PHP_EOL, $data);
  148. return $data;
  149. }
  150. function clean_contents($contents) {
  151. // $str = preg_replace('#<([^>\s/]+)[^>]*>#','<$1>', $contents);
  152. // return $str;
  153. $sa = new cleanHtml;
  154. $sa->allow = array( 'src' );
  155. $sa->exceptions = array(
  156. 'img' => array( 'src', 'alt' ),
  157. //'a' => array( 'href', 'title' ),
  158. 'iframe'=>array('src','frameborder'),
  159. );
  160. $str = $sa->strip( $contents );
  161. return $str;
  162. }
  163. function xfm_strong_str_replace_once($search, $replace, $subject) {
  164. $firstChar = strpos($subject, $search);
  165. if($firstChar !== false) {
  166. $beforeStr = substr($subject,0,$firstChar);
  167. $afterStr = substr($subject, $firstChar + strlen($search));
  168. return $beforeStr.$replace.$afterStr;
  169. } else {
  170. return $subject;
  171. }
  172. }
  173. //参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
  174. function curl_request($url,$post='',$cookie='', $returnCookie=0){
  175. if (! extension_loaded('curl')) {
  176. file_exists('./ext/php_curl.dll') && dl('php_curl.dll'); // 加载扩展
  177. }
  178. $curl = curl_init();
  179. curl_setopt($curl, CURLOPT_URL, $url);
  180. curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');
  181. if (ini_get('open_basedir') == '' && strtolower(ini_get('safe_mode')) != 'on'){
  182. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  183. }
  184. curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
  185. curl_setopt($curl, CURLOPT_REFERER, "http://XXX");
  186. if($post) {
  187. curl_setopt($curl, CURLOPT_POST, 1);
  188. curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
  189. }
  190. if($cookie) {
  191. curl_setopt($curl, CURLOPT_COOKIE, $cookie);
  192. }
  193. curl_setopt($curl, CURLOPT_HEADER, $returnCookie);
  194. curl_setopt($curl, CURLOPT_TIMEOUT, 150);
  195. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  196. $data = curl_exec($curl);
  197. if (curl_errno($curl)) {
  198. return curl_error($curl);
  199. }
  200. curl_close($curl);
  201. if($returnCookie){
  202. list($header, $body) = explode("\r\n\r\n", $data, 2);
  203. preg_match_all("/Set\-Cookie:([^;]*);/", $header, $matches);
  204. $info['cookie'] = substr($matches[1][0], 1);
  205. $info['content'] = $body;
  206. return $info;
  207. }else{
  208. return $data;
  209. }
  210. }
  211. //echo $tag;
  212. // 计算中文字符串长度
  213. function utf8_strlen($string = null) {
  214. // 将字符串分解为单元
  215. preg_match_all("/./us", $string, $match);
  216. // 返回单元个数
  217. return count($match[0]);
  218. }
  219. function reg_escape( $str )
  220. {
  221. $conversions = array( "^" => "\^", "[" => "\[", "." => "\.", "$" => "\$", "{" => "\{", "*" => "\*", "(" => "\(", "\\" => "\\\\", "/" => "\/", "+" => "\+", ")" => "\)", "|" => "\|", "?" => "\?", "<" => "\<", ">" => "\>" );
  222. return strtr( $str, $conversions );
  223. }
  224. /**
  225. * Strip attribute Class
  226. * Remove attributes from XML elements
  227. * @author David (semlabs.co.uk)
  228. * @version 0.2.1
  229. */
  230. class cleanHtml{
  231. public $str = '';
  232. public $allow = array();
  233. public $exceptions = array();
  234. public $ignore = array();
  235. public function strip( $str )
  236. {
  237. $this->str = $str;
  238. if( is_string( $str ) && strlen( $str ) > 0 )
  239. {
  240. $res = $this->findElements();
  241. if( is_string( $res ) )
  242. return $res;
  243. $nodes = $this->findAttributes( $res );
  244. $this->removeAttributes( $nodes );
  245. }
  246. return $this->str;
  247. }
  248. private function findElements()
  249. {
  250. # Create an array of elements with attributes
  251. $nodes = array();
  252. preg_match_all( "/<([^ !\/\>\n]+)([^>]*)>/i", $this->str, $elements );
  253. foreach( $elements[1] as $el_key => $element )
  254. {
  255. if( $elements[2][$el_key] )
  256. {
  257. $literal = $elements[0][$el_key];
  258. $element_name = $elements[1][$el_key];
  259. $attributes = $elements[2][$el_key];
  260. if( is_array( $this->ignore ) && !in_array( $element_name, $this->ignore ) )
  261. $nodes[] = array( 'literal' => $literal, 'name' => $element_name, 'attributes' => $attributes );
  262. }
  263. }
  264. # Return the XML if there were no attributes to remove
  265. if( !$nodes[0] )
  266. return $this->str;
  267. else
  268. return $nodes;
  269. }
  270. private function findAttributes( $nodes )
  271. {
  272. # Extract attributes
  273. foreach( $nodes as &$node )
  274. {
  275. preg_match_all( "/([^ =]+)\s*=\s*[\"|']{0,1}([^\"']*)[\"|']{0,1}/i", $node['attributes'], $attributes );
  276. if( $attributes[1] )
  277. {
  278. foreach( $attributes[1] as $att_key => $att )
  279. {
  280. $literal = $attributes[0][$att_key];
  281. $attribute_name = $attributes[1][$att_key];
  282. $value = $attributes[2][$att_key];
  283. $atts[] = array( 'literal' => $literal, 'name' => $attribute_name, 'value' => $value );
  284. }
  285. }
  286. else
  287. $node['attributes'] = null;
  288. $node['attributes'] = $atts;
  289. unset( $atts );
  290. }
  291. return $nodes;
  292. }
  293. private function removeAttributes( $nodes )
  294. {
  295. # Remove unwanted attributes
  296. foreach( $nodes as $node )
  297. {
  298. # Check if node has any attributes to be kept
  299. $node_name = $node['name'];
  300. $new_attributes = '';
  301. if( is_array( $node['attributes'] ) )
  302. {
  303. foreach( $node['attributes'] as $attribute )
  304. {
  305. if( ( is_array( $this->allow ) && in_array( $attribute['name'], $this->allow ) ) || $this->isException( $node_name, $attribute['name'], $this->exceptions ) )
  306. $new_attributes = $this->createAttributes( $new_attributes, $attribute['name'], $attribute['value'] );
  307. }
  308. }
  309. $replacement = ( $new_attributes ) ? "<$node_name $new_attributes>" : "<$node_name>";
  310. $this->str = preg_replace( '/'. reg_escape( $node['literal'] ) .'/', $replacement, $this->str );
  311. }
  312. }
  313. private function isException( $element_name, $attribute_name, $exceptions )
  314. {
  315. if( array_key_exists($element_name, $this->exceptions) )
  316. {
  317. if( in_array( $attribute_name, $this->exceptions[$element_name] ) )
  318. return true;
  319. }
  320. return false;
  321. }
  322. private function createAttributes( $new_attributes, $name, $value )
  323. {
  324. if( $new_attributes )
  325. $new_attributes .= " ";
  326. $new_attributes .= "$name=\"$value\"";
  327. return $new_attributes;
  328. }
  329. }
  330. ?>

照顾英文能力较差的同学,以下为中文版

PHP是一种被广泛应用的开源通用脚本语言,尤其适用于 Web 开发。

拥有快速,灵活,实用的特点,PHP能做任何事,包括你的个人博客甚至是全球性的大型站点系统。

PHP内核由C开发,因此在语法上跟C有不少相似之处。但PHP绝对不是C。

PHP语法除了跟C有相似之处外,还跟Java、Perl比较流行的编程语言存在相似的地方。因此,如果你有上述语言基础,PHP入门会更加快速。
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/725439
推荐阅读
相关标签
  

闽ICP备14008679号