Php development documentation members are charged for Phase 1. Introduce the latest project-membership charges, in order to better present it to users and add new features (membership mechanism ). Index process Display Interface 2 get discount
Introduction
The latest project-membership charges, aims to better present to users and add new features (membership mechanism ).
Index
Flowchart
1> Display Interface
2> get discount prices
Interface Description
Http request script (curl or socket)
Test data
Flowchart
Here, the demo is displayed through url, and the mst is a parameter, which is displayed through different parameters. Such as: http://www.demo.com /? Mst = 1 indicates the demo style of parameter 1.
Display Interface (4 cases)
Get discount price
Interface Description
1. activate a senior member
Psid = 2
Pstype = 101
2. activate a member
Psid = 1
Pstype = 101
3. [member/Senior member] price information
Wiki address: http://wiki.1verge.net/projects:premium:v2:product_rules_api?#member level idget level information
4. [whether it is a member]
Wiki address: http://wiki.1verge.net/projects:premium:v2:verify_center_api#receives the current membership level
5. [discount information]
Wiki address: Wikipedia
6. monthly subscription programs + rights to watch + senior members show "you are a senior member and can watch this program for free"
7. only monthly subscription programs + have the right to watch + senior members prompt "renew"
8. if you have more than 6 views, the "end date" is displayed"
The list_shows_by_pkgid function in Premium. class. php can be used to encapsulate the call function.
Http request script (curl or socket)
The 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. VOD Information Program ID: 1e390718b72311df97c0.html
2. vip user ID: 123350942
3. Common User ID: 106738702
Program ID: cbfb035e962411de83b1.html
The latest member project-membership charges, aims to better present the information to users and add new features (membership mechanism ). Index flowchart 1 Display Interface 2 get discount...