The
describes the
Latest project-membership fees, designed to be presented to users in a better presentation format, and to add new features (membership mechanisms).
Index
Flowchart
1> Show interface
2> get discount Price
Interface Description
HTTP request script (curl or socket)
Test number The demo in the
flowchart
is displayed through a URL, where the MST is a parameter and is displayed with different parameters. For example: Http://www.demo.com/?mst=1 represents a demo style with a parameter of 1.
Presentation Interface (4 cases)
Get discount price
Interface Description
1, open senior member
psid=2
pstype=101
2, Open member
psid=1
pstype=101
3, [member/Advanced member] Price information
Wiki address: http://wiki.1verge.net/projects:premium:v2:product_ rules_api# the rank information according to the member level ID
4, [is a member]
Wiki address: http://wiki.1verge.net/projects:premium:v2:verify_center_api# Get current membership Level
5, [discount info]
Wiki address: http://wiki.1verge.net/projects:premium:v2:operation_api# service cycle number based on user id_ service Id_ Service Type _ _ Get the discount policy that the current user can enjoy
6, can be a monthly program + entitled to watch + senior members will show that "you are a senior member, you can watch this program for free"
7, only monthly program + entitled to watch + Senior member tips "Renewal"
8, except 6 + have the right to watch then show "Due Date"
You can continue to encapsulate the calling function
http request script (curl or socket)
in Premium.class.php list_shows_by_pkgid function
Copy Code code as follows:
<?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);
}
}
return $result;
}
test Data
1. On-Demand Information program id:1e390718b72311df97c0.html
2, VIP user id:123350942
3, Ordinary user id:106738702
Have the right to watch the program ID:cbfb035e962411de83b1.html