7、仅包月节目+有权观看+高级会员提示“续费”
8、除 6 以外+有权观看则显示“截止日期”
可以在
Premium.
class
.php 中 list_shows_by_pkgid 函数下面继续封装调用函数
http 请求脚本(curl 或 socket)
代码如下
:
<?php
function
httpRequest(
$url
,
$hostName
,
array
$params
){
$postParams
=
array
();
foreach
(
$params
as
$key
=>
$val
) {
$post_params
[] =
$key
.'='.rawurlencode(
$val
);
}
$postString
= implode('&',
$post_params
);
$result
= '';
if
(function_exists('curl_init')) {
$ch
= curl_init();
curl_setopt(
$ch
, CURLOPT_URL,
$url
);
curl_setopt(
$ch
, CURLOPT_HTTPHEADER,
array
('Host: ' .
$hostName
));
curl_setopt(
$ch
, CURLOPT_POST, 1);
curl_setopt(
$ch
, CURLOPT_POSTFIELDS,
$postString
);
curl_setopt(
$ch
, CURLOPT_RETURNTRANSFER, true);
curl_setopt(
$ch
, CURLOPT_USERAGENT, 'DEMO.COM PREMIUM PHP5 Client ver: ' .
phpversion());
curl_setopt(
$ch
, CURLOPT_TIMEOUT, 2);
$result
= curl_exec(
$ch
);
curl_close(
$ch
);
}
else
{
$context
=
array
('http' =>
array
('method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded' . "\r\n".
'Host: '.
$hostName
. "\r\n".
'User-Agent: TEST.COM BC Test PHP5 Client ver: ' . phpversion() . "\r\n".
'Content-length: ' .
strlen
(
$postString
),
'content' =>
$postString
));
$contextId
= stream_context_create(
$context
);
$handle
=
fopen
(
$url
, 'r', false,
$contextId
);
if
(
$handle
) {
while
(!
feof
(
$handle
))
$result
.=
fgets
(
$sock
, 4096);
fclose(
$handle
);
}
}