Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
d28f3a18
Commit
d28f3a18
authored
Jun 11, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c64795d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
8 deletions
+69
-8
Reptile.php
application/search/controller/Reptile.php
+32
-7
ReptileService.php
application/search/service/ReptileService.php
+37
-1
No files found.
application/search/controller/Reptile.php
View file @
d28f3a18
...
...
@@ -28,7 +28,31 @@ class Reptile extends Basic
return
view
(
"reptile/index"
);
}
# 实时爬取米扑代理API接口 (curl)
function
getHaoZu1111
()
{
$proxy_url
=
"https://proxyapi.mimvp.com/api/fetchsecret.php?orderid=867304249961220216&http_type=3"
;
$result
=
$this
->
service_
->
getHaoZu
(
$proxy_url
);
//var_dump($result);
$proxy_list
=
explode
(
"
\n
"
,
$result
);
foreach
(
$proxy_list
as
$proxy
)
{
echo
"
$proxy
"
;
echo
"-----"
;
}
}
public
function
getHaoZu
()
{
$stop_url
=
"106.12.11.187:9899"
;
// $url = "https://www.haozu.com/sh/house-list/o2";
$url
=
"https://www.baidu.com"
;
$result
=
$this
->
service_
->
getHaoZu
(
$url
);
dump
(
$result
);
}
public
function
getHaoZu111
()
{
set_time_limit
(
0
);
// 取消脚本运行时间的超时上限
$url
=
"https://www.haozu.com/sh/house-list/o2"
;
...
...
@@ -37,14 +61,14 @@ class Reptile extends Basic
preg_match_all
(
"/www.haozu.com
\\
/\w+
\\
/house\d+/"
,
$result
,
$matches
);
$new_arr
=
array_unique
(
$matches
[
0
]);
foreach
(
$new_arr
as
$key
)
{
$params
=
[];
$body
=
$this
->
service_
->
getHaoZu
(
$key
);
$params
[
"title"
]
=
$this
->
getTitle
(
$body
);
$value
=
$this
->
getAddress
(
$body
);
$params
=
[];
$body
=
$this
->
service_
->
getHaoZu
(
$key
);
$params
[
"title"
]
=
$this
->
getTitle
(
$body
);
$value
=
$this
->
getAddress
(
$body
);
$params
[
"address"
]
=
$value
[
10
];
dump
(
$params
);
/* preg_match("/\d+/", $value[14], $match1);
$params["floor_total"] = $match1[0];*/
/* preg_match("/\d+/", $value[14], $match1);
$params["floor_total"] = $match1[0];*/
// echo $key;
...
...
@@ -68,7 +92,8 @@ class Reptile extends Basic
return
$match1
[
0
];
}
private
function
getAddress
(
$result
){
private
function
getAddress
(
$result
)
{
//dump($result);
try
{
preg_match_all
(
"/(?<=
\"
s2
\"
>)[^<>]+(?=<)/"
,
$result
,
$match1
);
...
...
application/search/service/ReptileService.php
View file @
d28f3a18
...
...
@@ -21,10 +21,45 @@ class ReptileService
"Content-Type"
=>
"application/json;charset=utf-8"
,
];
$curl
->
options
=
[
"CURLOPT_PROXY"
=>
"42.177.136.123:56503"
,
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
$response
=
$curl
->
post
(
$url
,
[]
);
$response
=
$curl
->
get
(
$url
);
return
$response
;
}
/**
*
*/
public
function
curl_post
(
$proxy_uri
,
$mimvp_url
)
{
/* $PROXY_USERNAME = "6c15b9a7798a";
$PROXY_PASSEORD = "988863e576";*/
/* $proxy_type = explode('://', $proxy_uri)[0]; // http, https, socks4, socks5
$proxy_ip_port = explode('://', $proxy_uri)[1]; // ip:port
echo "proxy_uri: $proxy_uri ; proxy_type: $proxy_type , proxy_ip_port: $proxy_ip_port ";*/
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$mimvp_url
);
curl_setopt
(
$ch
,
CURLOPT_HTTPPROXYTUNNEL
,
false
);
curl_setopt
(
$ch
,
CURLOPT_PROXY
,
$proxy_uri
);
# 设置代理授权
/* curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$PROXY_USERNAME}:{$PROXY_PASSEORD}");*/
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
2
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
0
);
// https
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
60
);
curl_setopt
(
$ch
,
CURLOPT_CONNECTTIMEOUT
,
60
);
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
// 返回网页内容*/
$result
=
curl_exec
(
$ch
);
dump
(
$result
);
curl_close
(
$ch
);
return
$result
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment