Introduction
Latest project-member fees, the purpose is to show the user in a better form, and add new features (membership mechanism).
Index
Flow chart
1> Display Interface
2> Get Discounted price
Interface description
HTTP request script (curl or socket)
Test data
Flowchart
The inside of the demo: is through the URL to show, the inside of the MST is a parameter, through different parameters to show. Example: Http://www.demo.com/?mst=1 represents a demo style with a parameter of 1.
Display Interface (4 cases)
Get discounted Rates
Interface Description
1, the opening of senior members
psid=2
Pstype=101
2. Opening members
Psid=1
Pstype=101
3. [member/Premium Member] Price information
Wiki Address: http://wiki.1verge.net/projects:premium:v2:product_rules_api# level information based on membership level ID
4. [Is it a member]
Wiki address: http://wiki.1verge.net/projects:premium:v2:verify_center_api# get current membership level
5. [Discount Information]
Wiki address: http://wiki.1verge.net/projects:premium:v2:operation_api# based on user id_ service Id_ service Type _ Service cycle number _ Get the discount policy that the current user can enjoy
6, can be a monthly program + right to watch + senior members Show "You are a senior member, free to watch this program"
7, only monthly program + right to watch + Advanced member tips "Renewal"
8, except 6 + the right to watch the "due date" display
You can continue to encapsulate the calling function under the List_shows_by_pkgid function in Premium.class.php
HTTP request script (curl or socket)
Copy CodeThe code is as follows:
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);
}
}
return $result;
}
test Data
1. On-Demand Information program id:1e390718b72311df97c0.html
2, VIP user id:123350942
3, Ordinary user id:106738702
Entitled to watch the show ID:cbfb035e962411de83b1.html
http://www.bkjia.com/PHPjc/325739.html www.bkjia.com true http://www.bkjia.com/PHPjc/325739.html techarticle introduce the latest project-member fees, the purpose is to show the user in a better form, and add new features (membership mechanism). Index Flowchart 1 Display interface 2 Get fold ...