PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 260917
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v260917
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
s2member / src / includes / externals / aweber / curl_object.php

curl_object.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 260917, at src/includes/externals/aweber/curl_object.php

103 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // @codingStandardsIgnoreFile
3
4 /**
5 * CurlInterface
6 *
7 * An object-oriented shim that wraps the standard PHP cURL library.
8 *
9 * This interface has been created so that cURL functionality can be stubbed
10 * out for unit testing, or swapped for an alternative library.
11 *
12 * @see curl
13 * @package
14 * @version $id$
15 */
16 interface CurlInterface {
17
18 /**
19 * errNo
20 *
21 * Encapsulates curl_errno - Returns the last error number
22 * @param resource $ch - A cURL handle returned by init.
23 * @access public
24 * @return the error number or 0 if no error occured.
25 */
26 public function errno($ch);
27
28 /**
29 * error
30 *
31 * Encapsulates curl_error - Return last error string
32 * @param resource $ch - A cURL handle returned by init.
33 * @access public
34 * @return the error messge or '' if no error occured.
35 */
36 public function error($ch);
37
38 /**
39 * execute
40 *
41 * Encapsulates curl_exec - Perform a cURL session.
42 * @param resource $ch - A cURL handle returned by init.
43 * @access public
44 * @return TRUE on success, FALSE on failure.
45 */
46 public function execute($ch);
47
48 /**
49 * init
50 *
51 * Encapsulates curl_init - Initialize a cURL session.
52 * @param string $url - url to use.
53 * @access public
54 * @return cURL handle on success, FALSE on failure.
55 */
56 public function init($url);
57
58 /**
59 * setopt
60 *
61 * Encapsulates curl_setopt - Set an option for cURL transfer.
62 * @param resource $ch - A cURL handle returned by init.
63 * @param int $opt - The CURLOPT to set.
64 * @param mixed $value - The value to set.
65 * @access public
66 * @return True on success, FALSE on failure.
67 */
68 public function setopt ($ch , $option , $value);
69 }
70
71
72 /**
73 * CurlObject
74 *
75 * A concrete implementation of CurlInterface using the PHP cURL library.
76 *
77 * @package
78 * @version $id$
79 */
80 class CurlObject implements CurlInterface {
81
82 public function errno($ch) {
83 return curl_errno($ch);
84 }
85
86 public function error($ch) {
87 return curl_error($ch);
88 }
89
90 public function execute($ch) {
91 return curl_exec($ch);
92 }
93
94 public function init($url) {
95 return curl_init($url);
96 }
97
98 public function setopt ($ch , $option , $value) {
99 return curl_setopt($ch, $option, $value);
100 }
101
102 }
103