52 | Don't worry, please send your transaction screenshot to our chat support or email. We will add the chips in
53 | your Ludo Buddy account. Please mention your registered mobile number in email.
54 |
13 | 1.You can set a game for yourself or you can chooose to play a game set by others
14 | 2.Once you click on play button, You need to create a roomid on ludoking app and enter it when asked
15 | in prompt box
16 | 3.After that you and your oppponent will be redirected to room code page
17 | 4.Your opponent will join the game using room code set by you or vice versa if he clicks play button
18 | 5.Finally play the game and upload your winning or loosing screenshot in room page
19 | 6.After that admin will approve winners and tokens will be added to winners after deducting platform charges, which you can withdraw by placing withdrawal requests
20 |
21 | Note:
22 |
23 | Dont forget to rename your screenshot with the registered number on this website
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/ludo_legion3.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 5.0.1
3 | -- https://www.phpmyadmin.net/
4 | --
5 | -- Host: 127.0.0.1
6 | -- Generation Time: Aug 22, 2020 at 08:57 AM
7 | -- Server version: 10.4.11-MariaDB
8 | -- PHP Version: 7.4.2
9 |
10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11 | SET AUTOCOMMIT = 0;
12 | START TRANSACTION;
13 | SET time_zone = "+00:00";
14 |
15 |
16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19 | /*!40101 SET NAMES utf8mb4 */;
20 |
21 | --
22 | -- Database: `ludo_legion`
23 | --
24 |
25 | -- --------------------------------------------------------
26 |
27 | --
28 | -- Table structure for table `chips`
29 | --
30 |
31 | CREATE TABLE `chips` (
32 | `user` varchar(255) NOT NULL,
33 | `chips` int(255) NOT NULL
34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
35 |
36 | --
37 | -- Dumping data for table `chips`
38 | --
39 |
40 | INSERT INTO `chips` (`user`, `chips`) VALUES
41 | ('213', 100),
42 | ('8096', 100),
43 | ('9505', 100),
44 | ('949', 100),
45 | ('703', 100),
46 | ('7036723563', 100),
47 | ('9490780213', 100);
48 |
49 | -- --------------------------------------------------------
50 |
51 | --
52 | -- Table structure for table `history`
53 | --
54 |
55 | CREATE TABLE `history` (
56 | `winner` varchar(255) DEFAULT NULL,
57 | `looser` varchar(255) DEFAULT NULL,
58 | `ludo_id` varchar(255) DEFAULT NULL,
59 | `amount` int(255) NOT NULL
60 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
61 |
62 | --
63 | -- Dumping data for table `history`
64 | --
65 |
66 | INSERT INTO `history` (`winner`, `looser`, `ludo_id`, `amount`) VALUES
67 | ('NULL', 'NULL', 'BPmMai', 21),
68 | ('NULL', 'NULL', 'QPnnjp', 21),
69 | ('NULL', 'NULL', 'WBvzCv', 21),
70 | ('NULL', 'NULL', 'wKPtjK', 21),
71 | ('NULL', 'NULL', 'QeQvfL', 21),
72 | ('NULL', 'NULL', 'ahDiia', 21),
73 | ('NULL', 'NULL', 'QkZlUf', 21);
74 |
75 | -- --------------------------------------------------------
76 |
77 | --
78 | -- Table structure for table `open`
79 | --
80 |
81 | CREATE TABLE `open` (
82 | `user_name` varchar(255) NOT NULL,
83 | `amount` varchar(255) NOT NULL,
84 | `status` varchar(255) NOT NULL,
85 | `phone_no` bigint(255) NOT NULL
86 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
87 |
88 | -- --------------------------------------------------------
89 |
90 | --
91 | -- Table structure for table `running`
92 | --
93 |
94 | CREATE TABLE `running` (
95 | `ludo_id` varchar(255) NOT NULL,
96 | `room_id` varchar(255) NOT NULL,
97 | `player1` varchar(255) NOT NULL,
98 | `player2` varchar(255) NOT NULL,
99 | `amount` int(255) NOT NULL
100 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
101 |
102 | --
103 | -- Dumping data for table `running`
104 | --
105 |
106 | INSERT INTO `running` (`ludo_id`, `room_id`, `player1`, `player2`, `amount`) VALUES
107 | ('QkZlUf', '8215476809', 'abc', 'def', 21);
108 |
109 | -- --------------------------------------------------------
110 |
111 | --
112 | -- Table structure for table `users`
113 | --
114 |
115 | CREATE TABLE `users` (
116 | `user_name` varchar(255) NOT NULL,
117 | `phone_no` varchar(255) NOT NULL,
118 | `password` varchar(255) NOT NULL,
119 | `email` varchar(255) NOT NULL
120 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
121 |
122 | --
123 | -- Dumping data for table `users`
124 | --
125 |
126 | INSERT INTO `users` (`user_name`, `phone_no`, `password`, `email`) VALUES
127 | ('sai', '123', 'hy', ''),
128 | ('Madhu', '213', 'hy', ''),
129 | ('sai', '703', '123', ''),
130 | ('def', '7036723563', '563', 'ksmadhu1999@gmail.com'),
131 | ('Shabari', '8096', 'hy', ''),
132 | ('madhu', '949', '123', ''),
133 | ('abc', '9490780213', '213', 'saimadhukammari@gmail.com'),
134 | ('Naveen', '9505', 'hy', '');
135 |
136 | -- --------------------------------------------------------
137 |
138 | --
139 | -- Table structure for table `withdraw`
140 | --
141 |
142 | CREATE TABLE `withdraw` (
143 | `phone_no` varchar(255) NOT NULL,
144 | `user_name` varchar(255) NOT NULL,
145 | `amount` int(255) NOT NULL
146 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
147 |
148 | --
149 | -- Dumping data for table `withdraw`
150 | --
151 |
152 | INSERT INTO `withdraw` (`phone_no`, `user_name`, `amount`) VALUES
153 | ('213', 'sai', 20),
154 | ('8096', 'JS', 32);
155 |
156 | -- --------------------------------------------------------
157 |
158 | --
159 | -- Table structure for table `withdraw_req`
160 | --
161 |
162 | CREATE TABLE `withdraw_req` (
163 | `user_name` varchar(255) NOT NULL,
164 | `phone_no` varchar(255) NOT NULL,
165 | `amount` int(255) NOT NULL
166 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
167 |
168 | --
169 | -- Dumping data for table `withdraw_req`
170 | --
171 |
172 | INSERT INTO `withdraw_req` (`user_name`, `phone_no`, `amount`) VALUES
173 | ('Naveen', '9505', 50);
174 |
175 | --
176 | -- Indexes for dumped tables
177 | --
178 |
179 | --
180 | -- Indexes for table `users`
181 | --
182 | ALTER TABLE `users`
183 | ADD PRIMARY KEY (`phone_no`);
184 | COMMIT;
185 |
186 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
187 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
188 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
189 |
--------------------------------------------------------------------------------
/open_table.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
48 |
--------------------------------------------------------------------------------
/razor/README.md:
--------------------------------------------------------------------------------
1 | # Razorpay Test App for PHP
2 | Sample App for Razorpay PHP Integration
3 |
4 | This app uses a non composer integration, ideally you should use composer to integrate the Razorpay API.
5 |
6 | # Demo
7 | You can see a demo of the php-testapp by opening up the `index.html` file on your browser. Follow the steps below:
8 | 1. Copy the contents of config.php.sample to config.php.
9 | 2. Enter your key id / key secret in the config.php file.
10 | 3. If you'd like a currency other than INR, change the displayCurrency to whatever currency you'd like.
11 | 4. Watch the demo to test out automatic or manual checkout.
12 |
13 | An easy way to test this is to run `php -S localhost:8000` in the root directory
14 | and opening in your browser.
15 |
16 | ## Contents:
17 | 1. Automatic checkout test app
18 | 2. Manual checkout test app
19 |
20 | # Steps for Integration:
21 | ## Automatic Checkout
22 | 1. Make a checkout form using our Checkout Integration
23 | 2. Accept the `razorpay_payment_id` parameter in the form submission
24 | 3. Run the capture code to capture the payment
25 |
26 | If you are re-using this as your final code, please make sure you do the following:
27 | - Edit the keyId inside automatic-checkout/index.html
28 | - Edit the keyId/keySecret in automatic-checkout/charge.php
29 |
30 | ## Manual Checkout
31 | 1. Create an order using razorpay orders api
32 | 2. Accept the `razorpay_payment_id` parameter and `razorpay_signature` in the form submission
33 | 3. Store the `razorpay_order_id` as a sessions variable
34 | 3. Verify the signature emitted from our server based on the algorithm given at https://docs.razorpay.com/docs/orders
35 |
36 | If you are re-using this as your final code, please make sure you do the following:
37 | - Edit the keyId/keySecret inside orders-api/order.php
38 | - Edit the keySecret in orders-api/verify-signature.php
39 |
40 | # Razorpay PHP SDK
41 | Make sure that you download the latest version of `razorpay-php.zip` file from
42 | the releases section **[here](https://github.com/razorpay/razorpay-php/releases)**.
43 | You can extract that to the razorpay-php directory as well.
44 |
45 | This release currently uses the 1.2.8 version of the SDK. Please ensure that you are
46 | using the latest as the test app might lag behind.
--------------------------------------------------------------------------------
/razor/checkout/automatic.php:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 | Ludo Society
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
55 |
56 |
81 |
--------------------------------------------------------------------------------
/razor/checkout/manual.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/razor/config.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Ludo Society
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | 3456,
52 | 'amount' => $amount * 100, // 2000 rupees in paise
53 | 'currency' => 'INR',
54 | 'payment_capture' => 1 // auto capture
55 | ];
56 |
57 | $razorpayOrder = $api->order->create($orderData);
58 |
59 | $razorpayOrderId = $razorpayOrder['id'];
60 |
61 | $_SESSION['razorpay_order_id'] = $razorpayOrderId;
62 |
63 | $displayAmount = $amount = $orderData['amount'];
64 |
65 | if ($displayCurrency !== 'INR')
66 | {
67 | $url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR";
68 | $exchange = json_decode(file_get_contents($url), true);
69 |
70 | $displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100;
71 | }
72 |
73 | $checkout = 'automatic';
74 |
75 | if (isset($_GET['checkout']) and in_array($_GET['checkout'], ['automatic', 'manual'], true))
76 | {
77 | $checkout = $_GET['checkout'];
78 | }
79 |
80 | $data = [
81 | "key" => $keyId,
82 | "amount" => $amount,
83 | "name" => "LUDO SOCIETY",
84 | "description" => "Payment for buying chips",
85 | "image" => "http://192.168.225.51:8080/Projects/LudoLegion/resources/lb.png",
86 | "prefill" => [
87 | "name" => "Daft Punk",
88 | "email" => "customer@merchant.com",
89 | "contact" => $phone,
90 | ],
91 | "notes" => [
92 | "address" => "Hello World",
93 | "merchant_order_id" => "12312321",
94 | ],
95 | "theme" => [
96 | "color" => "#F37254"
97 | ],
98 | "order_id" => $razorpayOrderId,
99 | ];
100 |
101 | if ($displayCurrency !== 'INR')
102 | {
103 | $data['display_currency'] = $displayCurrency;
104 | $data['display_amount'] = $displayAmount;
105 | }
106 |
107 | $json = json_encode($data);
108 |
109 | require("checkout/{$checkout}.php");
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/razor/razorpay-php/README.md:
--------------------------------------------------------------------------------
1 | # razorpay-php
2 |
3 | [](https://travis-ci.org/razorpay/razorpay-php) [](https://packagist.org/packages/razorpay/razorpay) [](https://packagist.org/packages/razorpay/razorpay)
4 |
5 | Razorpay client PHP Api. The api follows the following practices:
6 |
7 | - namespaced under Razorpay\Api
8 | - call $api->class->function() to access the api
9 | - api throws exceptions instead of returning errors
10 | - options are passed as an array instead of multiple arguments wherever possible
11 | - All request and responses are communicated over JSON
12 | - A minimum of PHP 5.3 is required
13 |
14 | # Installation
15 |
16 | - If your project uses composer, add following to composer.json
17 | ```json
18 | {
19 | "require": {
20 | "razorpay/razorpay": "1.*"
21 | }
22 | }
23 | ```
24 |
25 | Then, run `composer update`. If you are not using composer, download
26 | the latest release from [the releases section](https://github.com/razorpay/razorpay-php/releases).
27 | **You should download the `razorpay-php.zip` file**.
28 |
29 | After that include `Razorpay.php` in your application and you can use the
30 | API as usual.
31 |
32 | # Usage
33 |
34 | ```php
35 | use Razorpay\Api\Api;
36 |
37 | $api = new Api($api_key, $api_secret);
38 | $api->payment->all($options); // Returns array of payment objects
39 | $payment = $api->payment->fetch($id); // Returns a particular payment
40 | $api->payment->fetch($id)->capture(array('amount'=>$amount)); // Captures a payment
41 | $api->payment->fetch($id)->refund(); // Refunds a payment
42 | $api->payment->fetch($id)->refund(array('amount'=>$refundAmount)); // Partially refunds a payment
43 |
44 | // To get the payment details
45 | echo $payment->amount;
46 | echo $payment->currency;
47 | // And so on for other attributes
48 | ```
49 |
50 | For further help, see our documentation on .
51 |
52 | [composer-install]: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
53 |
54 | ## Developing
55 |
56 | See the [doc.md](doc.md) file for getting started with development.
57 |
58 | ## License
59 |
60 | The Razorpay PHP SDK is released under the MIT License.
61 |
62 | ## Release
63 |
64 | Steps to follow for a release:
65 |
66 | 0. Merge the branch with the new code to master.
67 | 1. Bump the Version in `src/Api.php`.
68 | 2. Rename Unreleased to the new tag in `CHANGELOG`
69 | 3. Fix links at bottom in `CHANGELOG`
70 | 4. Commit
71 | 5. Tag the release and push to GitHub
72 | 6. Create a release on GitHub using the website with more details about the release
73 |
--------------------------------------------------------------------------------
/razor/razorpay-php/Razorpay.php:
--------------------------------------------------------------------------------
1 | =5.3.2",
32 | "rmccue/requests": "v1.6.1",
33 | "ext-json": "*"
34 | },
35 | "require-dev": {
36 | "raveren/kint": "1.*"
37 | },
38 | "autoload": {
39 | "psr-4": {
40 | "Razorpay\\Api\\": "src/",
41 | "Razorpay\\Tests\\": "tests/"
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/razor/razorpay-php/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "0320650f5da8e9cd6c4c985279a9963a",
8 | "packages": [
9 | {
10 | "name": "rmccue/requests",
11 | "version": "v1.6.1",
12 | "source": {
13 | "type": "git",
14 | "url": "https://github.com/rmccue/Requests.git",
15 | "reference": "6aac485666c2955077d77b796bbdd25f0013a4ea"
16 | },
17 | "dist": {
18 | "type": "zip",
19 | "url": "https://api.github.com/repos/rmccue/Requests/zipball/6aac485666c2955077d77b796bbdd25f0013a4ea",
20 | "reference": "6aac485666c2955077d77b796bbdd25f0013a4ea",
21 | "shasum": ""
22 | },
23 | "require": {
24 | "php": ">=5.2"
25 | },
26 | "require-dev": {
27 | "satooshi/php-coveralls": "dev-master"
28 | },
29 | "type": "library",
30 | "autoload": {
31 | "psr-0": {
32 | "Requests": "library/"
33 | }
34 | },
35 | "notification-url": "https://packagist.org/downloads/",
36 | "license": [
37 | "ISC"
38 | ],
39 | "authors": [
40 | {
41 | "name": "Ryan McCue",
42 | "homepage": "http://ryanmccue.info"
43 | }
44 | ],
45 | "description": "A HTTP library written in PHP, for human beings.",
46 | "homepage": "http://github.com/rmccue/Requests",
47 | "keywords": [
48 | "curl",
49 | "fsockopen",
50 | "http",
51 | "idna",
52 | "ipv6",
53 | "iri",
54 | "sockets"
55 | ],
56 | "time": "2014-05-18 04:59:02"
57 | }
58 | ],
59 | "packages-dev": [
60 | {
61 | "name": "raveren/kint",
62 | "version": "1.0.10",
63 | "source": {
64 | "type": "git",
65 | "url": "https://github.com/raveren/kint.git",
66 | "reference": "c8423b9928bd35bf6ad14c688ab9c6d17d97d0eb"
67 | },
68 | "dist": {
69 | "type": "zip",
70 | "url": "https://api.github.com/repos/raveren/kint/zipball/c8423b9928bd35bf6ad14c688ab9c6d17d97d0eb",
71 | "reference": "c8423b9928bd35bf6ad14c688ab9c6d17d97d0eb",
72 | "shasum": ""
73 | },
74 | "require": {
75 | "php": ">=5.1.0"
76 | },
77 | "type": "library",
78 | "extra": {
79 | "branch-alias": {
80 | "dev-master": "1.0.x-dev"
81 | }
82 | },
83 | "autoload": {
84 | "files": [
85 | "Kint.class.php"
86 | ]
87 | },
88 | "notification-url": "https://packagist.org/downloads/",
89 | "license": [
90 | "MIT"
91 | ],
92 | "authors": [
93 | {
94 | "name": "Rokas Šleinius",
95 | "homepage": "https://github.com/raveren"
96 | },
97 | {
98 | "name": "Contributors",
99 | "homepage": "https://github.com/raveren/kint/contributors"
100 | }
101 | ],
102 | "description": "Kint - debugging helper for PHP developers",
103 | "homepage": "https://github.com/raveren/kint",
104 | "keywords": [
105 | "debug",
106 | "kint",
107 | "php"
108 | ],
109 | "time": "2015-09-16 14:09:00"
110 | }
111 | ],
112 | "aliases": [],
113 | "minimum-stability": "stable",
114 | "stability-flags": [],
115 | "prefer-stable": false,
116 | "prefer-lowest": false,
117 | "platform": {
118 | "php": ">=5.3.2",
119 | "ext-json": "*"
120 | },
121 | "platform-dev": []
122 | }
123 |
--------------------------------------------------------------------------------
/razor/razorpay-php/doc.md:
--------------------------------------------------------------------------------
1 | This document talks about the implementation of the code for the Api.
2 |
3 | Everything comes under namespace Razorpay\Api\.
4 | Namespaces put a requirement of PHP 5.3 minimum
5 |
6 | ```php
7 | namespace Razorpay\
8 |
9 | class Api
10 | {
11 |
12 | // Contains a __get function that returns the appropriate
13 | // class object when one tries to access them.
14 | }
15 |
16 |
17 |
18 | namespace Razorpay\
19 |
20 | class Client
21 | {
22 | // Handles request and response
23 | // Uses Composer:Requests internally
24 | }
25 |
26 | class Payment
27 | {
28 | public function get($id)
29 | {
30 |
31 | }
32 |
33 | public function fetch($options)
34 | {
35 |
36 | }
37 |
38 | public function capture($id)
39 | {
40 |
41 | }
42 |
43 | public function refund($id)
44 | {
45 |
46 | }
47 | }
48 | ```
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/.coveralls.yml:
--------------------------------------------------------------------------------
1 | src_dir: library
2 | coverage_clover: tests/clover.xml
3 | json_path: tests/coveralls.json
4 | service_name: travis-ci
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | before_script:
3 | - phpenv local 5.4
4 | - composer install --dev --no-interaction
5 | - phpenv local --unset
6 | - cd tests
7 | script:
8 | - phpunit --coverage-clover clover.xml
9 | after_script:
10 | - cd ..
11 | - phpenv local 5.4
12 | - php vendor/bin/coveralls -v
13 | - phpenv local --unset
14 | php:
15 | - 5.2
16 | - 5.3
17 | - 5.4
18 | - 5.5
19 | - hhvm
20 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | Changelog
2 | =========
3 |
4 | 1.6.1
5 | -----
6 | - [Fix compatibility with HHVM][#121] - Using HHVM with Requests would
7 | previously cause either exceptions with SSL or segfaults with the cURL
8 | handler. Props Ozh for his work here.
9 |
10 | [#121]: https://github.com/rmccue/Requests/issues/121
11 |
12 | 1.6.0
13 | -----
14 | - [Add multiple request support][#23] - Send multiple HTTP requests with both
15 | fsockopen and cURL, transparently falling back to synchronous when
16 | not supported.
17 |
18 | - [Add proxy support][#70] - HTTP proxies are now natively supported via a
19 | [high-level API][docs/proxy]. Major props to Ozh for his fantastic work
20 | on this.
21 |
22 | - [Verify host name for SSL requests][#63] - Requests is now the first and only
23 | standalone HTTP library to fully verify SSL hostnames even with socket
24 | connections. Thanks to Michael Adams, Dion Hulse, Jon Cave, and Pádraic Brady
25 | for reviewing the crucial code behind this.
26 |
27 | - [Add cookie support][#64] - Adds built-in support for cookies (built entirely
28 | as a high-level API)
29 |
30 | - [Add sessions][#62] - To compliment cookies, [sessions][docs/usage-advanced]
31 | can be created with a base URL and default options, plus a shared cookie jar.
32 |
33 | - Add [PUT][#1], [DELETE][#3], and [PATCH][#2] request support
34 |
35 | - [Add Composer support][#6] - You can now install Requests via the
36 | `rmccue/requests` package on Composer
37 |
38 | [docs/proxy]: http://requests.ryanmccue.info/docs/proxy.html
39 | [docs/usage-advanced]: http://requests.ryanmccue.info/docs/usage-advanced.html
40 |
41 | [#1]: https://github.com/rmccue/Requests/issues/1
42 | [#2]: https://github.com/rmccue/Requests/issues/2
43 | [#3]: https://github.com/rmccue/Requests/issues/3
44 | [#6]: https://github.com/rmccue/Requests/issues/6
45 | [#9]: https://github.com/rmccue/Requests/issues/9
46 | [#23]: https://github.com/rmccue/Requests/issues/23
47 | [#62]: https://github.com/rmccue/Requests/issues/62
48 | [#63]: https://github.com/rmccue/Requests/issues/63
49 | [#64]: https://github.com/rmccue/Requests/issues/64
50 | [#70]: https://github.com/rmccue/Requests/issues/70
51 |
52 | [View all changes][https://github.com/rmccue/Requests/compare/v1.5.0...v1.6.0]
53 |
54 | 1.5.0
55 | -----
56 | Initial release!
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/LICENSE:
--------------------------------------------------------------------------------
1 | Requests
2 | ========
3 |
4 | Copyright (c) 2010-2012 Ryan McCue and contributors
5 |
6 | Permission to use, copy, modify, and/or distribute this software for any
7 | purpose with or without fee is hereby granted, provided that the above
8 | copyright notice and this permission notice appear in all copies.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 |
18 |
19 | ComplexPie IRI Parser
20 | =====================
21 |
22 | Copyright (c) 2007-2010, Geoffrey Sneddon and Steve Minutillo.
23 | All rights reserved.
24 |
25 | Redistribution and use in source and binary forms, with or without
26 | modification, are permitted provided that the following conditions are met:
27 |
28 | * Redistributions of source code must retain the above copyright notice,
29 | this list of conditions and the following disclaimer.
30 |
31 | * Redistributions in binary form must reproduce the above copyright notice,
32 | this list of conditions and the following disclaimer in the documentation
33 | and/or other materials provided with the distribution.
34 |
35 | * Neither the name of the SimplePie Team nor the names of its contributors
36 | may be used to endorse or promote products derived from this software
37 | without specific prior written permission.
38 |
39 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
43 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
44 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 | POSSIBILITY OF SUCH DAMAGE.
50 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/README.md:
--------------------------------------------------------------------------------
1 | Requests for PHP
2 | ================
3 |
4 | Requests is a HTTP library written in PHP, for human beings. It is roughly
5 | based on the API from the excellent [Requests Python
6 | library](http://python-requests.org/). Requests is [ISC
7 | Licensed](https://github.com/rmccue/Requests/blob/master/LICENSE) (similar to
8 | the new BSD license) and has no dependencies, except for PHP 5.2+.
9 |
10 | Despite PHP's use as a language for the web, its tools for sending HTTP requests
11 | are severely lacking. cURL has an
12 | [interesting API](http://php.net/manual/en/function.curl-setopt.php), to say the
13 | least, and you can't always rely on it being available. Sockets provide only low
14 | level access, and require you to build most of the HTTP response parsing
15 | yourself.
16 |
17 | We all have better things to do. That's why Requests was born.
18 |
19 | ```php
20 | $headers = array('Accept' => 'application/json');
21 | $options = array('auth' => array('user', 'pass'));
22 | $request = Requests::get('https://api.github.com/gists', $headers, $options);
23 |
24 | var_dump($request->status_code);
25 | // int(200)
26 |
27 | var_dump($request->headers['content-type']);
28 | // string(31) "application/json; charset=utf-8"
29 |
30 | var_dump($request->body);
31 | // string(26891) "[...]"
32 | ```
33 |
34 | Requests allows you to send **HEAD**, **GET**, **POST**, **PUT**, **DELETE**,
35 | and **PATCH** HTTP requests. You can add headers, form data, multipart files,
36 | and parameters with simple arrays, and access the response data in the same way.
37 | Requests uses cURL and fsockopen, depending on what your system has available,
38 | but abstracts all the nasty stuff out of your way, providing a consistent API.
39 |
40 |
41 | Features
42 | --------
43 |
44 | - International Domains and URLs
45 | - Browser-style SSL Verification
46 | - Basic/Digest Authentication
47 | - Automatic Decompression
48 | - Connection Timeouts
49 |
50 |
51 | Installation
52 | ------------
53 |
54 | ### Install with Composer
55 | If you're using [Composer](https://github.com/composer/composer) to manage
56 | dependencies, you can add Requests with it.
57 |
58 | {
59 | "require": {
60 | "rmccue/requests": ">=1.0"
61 | },
62 | "autoload": {
63 | "psr-0": {"Requests": "library/"}
64 | }
65 | }
66 |
67 | ### Install source from GitHub
68 | To install the source code:
69 |
70 | $ git clone git://github.com/rmccue/Requests.git
71 |
72 | And include it in your scripts:
73 |
74 | require_once '/path/to/Requests/library/Requests.php';
75 |
76 | You'll probably also want to register an autoloader:
77 |
78 | Requests::register_autoloader();
79 |
80 |
81 | ### Install source from zip/tarball
82 | Alternatively, you can fetch a [tarball][] or [zipball][]:
83 |
84 | $ curl -L https://github.com/rmccue/Requests/tarball/master | tar xzv
85 | (or)
86 | $ wget https://github.com/rmccue/Requests/tarball/master -O - | tar xzv
87 |
88 | [tarball]: https://github.com/rmccue/Requests/tarball/master
89 | [zipball]: https://github.com/rmccue/Requests/zipball/master
90 |
91 |
92 | ### Using a Class Loader
93 | If you're using a class loader (e.g., [Symfony Class Loader][]) for
94 | [PSR-0][]-style class loading:
95 |
96 | $loader->registerPrefix('Requests', 'path/to/vendor/Requests/library');
97 |
98 | [Symfony Class Loader]: https://github.com/symfony/ClassLoader
99 | [PSR-0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
100 |
101 |
102 | Documentation
103 | -------------
104 | The best place to start is our [prose-based documentation][], which will guide
105 | you through using Requests.
106 |
107 | After that, take a look at [the documentation for
108 | `Requests::request()`][request_method], where all the parameters are fully
109 | documented.
110 |
111 | Requests is [100% documented with PHPDoc](http://requests.ryanmccue.info/api/).
112 | If you find any problems with it, [create a new
113 | issue](https://github.com/rmccue/Requests/issues/new)!
114 |
115 | [prose-based documentation]: https://github.com/rmccue/Requests/blob/master/docs/README.md
116 | [request_method]: http://requests.ryanmccue.info/api/class-Requests.html#_request
117 |
118 | Testing
119 | -------
120 | [](http://travis-ci.org/rmccue/Requests)
121 | [][coveralls]
122 |
123 | Requests strives to have 100% code-coverage of the library with an extensive
124 | set of tests. We're not quite there yet, but [we're getting close][coveralls].
125 |
126 | [coveralls]: https://coveralls.io/r/rmccue/Requests?branch=master
127 |
128 | To run the test suite, simply:
129 |
130 | $ cd tests
131 | $ phpunit
132 |
133 | If you'd like to run a single set of tests, specify just the name:
134 |
135 | $ phpunit Transport/cURL
136 |
137 | Contribute
138 | ----------
139 |
140 | 1. Check for open issues or open a new issue for a feature request or a bug
141 | 2. Fork [the repository][] on Github to start making your changes to the
142 | `master` branch (or branch off of it)
143 | 3. Write a test which shows that the bug was fixed or that the feature works as expected
144 | 4. Send a pull request and bug me until I merge it
145 |
146 | [the repository]: https://github.com/rmccue/Requests
147 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/bin/create_pear_package.php:
--------------------------------------------------------------------------------
1 | ' . PHP_EOL;
13 | echo PHP_EOL;
14 | echo ' version:' . PHP_EOL;
15 | echo ' Version of the package, in the form of major.minor.bug' . PHP_EOL;
16 | echo PHP_EOL;
17 | echo ' stability:' . PHP_EOL;
18 | echo ' One of alpha, beta, stable' . PHP_EOL;
19 | die();
20 | }
21 |
22 | if (!isset($argv[2])) {
23 | die('You must provide the stability (alpha, beta, or stable)');
24 | }
25 |
26 | $context = array(
27 | 'date' => gmdate('Y-m-d'),
28 | 'time' => gmdate('H:m:00'),
29 | 'version' => $argv[1],
30 | 'api_version' => $argv[1],
31 | 'stability' => $argv[2],
32 | 'api_stability' => $argv[2],
33 | );
34 |
35 | $context['files'] = '';
36 | $path = realpath(dirname(__FILE__).'/../library/Requests');
37 | foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
38 | if (preg_match('/\.php$/', $file)) {
39 | $name = str_replace($path . DIRECTORY_SEPARATOR, '', $file);
40 | $name = str_replace(DIRECTORY_SEPARATOR, '/', $name);
41 | $context['files'][] = "\t\t\t\t\t" . '';
42 | }
43 | }
44 |
45 | $context['files'] = implode("\n", $context['files']);
46 |
47 | $template = file_get_contents(dirname(__FILE__).'/../package.xml.tpl');
48 | $content = preg_replace_callback('/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/', 'replace_parameters', $template);
49 | file_put_contents(dirname(__FILE__).'/../package.xml', $content);
50 |
51 | function replace_parameters($matches) {
52 | global $context;
53 |
54 | return isset($context[$matches[1]]) ? $context[$matches[1]] : null;
55 | }
56 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rmccue/requests",
3 | "description": "A HTTP library written in PHP, for human beings.",
4 | "homepage": "http://github.com/rmccue/Requests",
5 | "license": "ISC",
6 | "keywords": ["http", "idna", "iri", "ipv6", "curl", "sockets", "fsockopen"],
7 | "authors": [
8 | {
9 | "name": "Ryan McCue",
10 | "homepage": "http://ryanmccue.info"
11 | }
12 | ],
13 | "require": {
14 | "php": ">=5.2"
15 | },
16 | "require-dev": {
17 | "satooshi/php-coveralls": "dev-master"
18 | },
19 | "type": "library",
20 | "autoload": {
21 | "psr-0": {"Requests": "library/"}
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/README.md:
--------------------------------------------------------------------------------
1 | Documentation
2 | =============
3 |
4 | If you're here, you're looking for documentation for Requests! The documents
5 | here are prose; you might also want to check out the [API documentation][].
6 |
7 | [API documentation]: http://requests.ryanmccue.info/api/
8 |
9 | * Introduction
10 | * [Goals][goals]
11 | * [Why should I use Requests instead of X?][why-requests]
12 | * Usage
13 | * [Making a request][usage]
14 | * [Advanced usage][usage-advanced]
15 | * [Authenticating your request][authentication]
16 | * Advanced Usage
17 | * [Custom authentication][authentication-custom]
18 | * [Requests through proxy][proxy]
19 | * [Hooking system][hooks]
20 |
21 | [goals]: goals.md
22 | [why-requests]: why-requests.md
23 | [usage]: usage.md
24 | [usage-advanced]: usage-advanced.md
25 | [authentication]: authentication.md
26 | [authentication-custom]: authentication-custom.md
27 | [hooks]: hooks.md
28 | [proxy]: proxy.md
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/authentication-custom.md:
--------------------------------------------------------------------------------
1 | Custom Authentication
2 | =====================
3 | Custom authentication handlers are designed to be extremely simple to write.
4 | In order to write a handler, you'll need to implement the `Requests_Auth`
5 | interface.
6 |
7 | An instance of this handler is then passed in by the user via the `auth`
8 | option, just like for normal authentication.
9 |
10 | Let's say we have a HTTP endpoint that checks for the `Hotdog` header and
11 | authenticates you if said header is set to `Yummy`. (I don't know of any
12 | services that do this; perhaps this is a market waiting to be tapped?)
13 |
14 | ```php
15 | class MySoftware_Auth_Hotdog implements Requests_Auth {
16 | protected $password;
17 |
18 | public function __construct($password) {
19 | $this->password = $password;
20 | }
21 |
22 | public function register(Requests_Hooks &$hooks) {
23 | $hooks->register('requests.before_request', array(&$this, 'before_request'));
24 | }
25 |
26 | public function before_request(&$url, &$headers, &$data, &$type, &$options) {
27 | $headers['Hotdog'] = $this->password;
28 | }
29 | }
30 | ```
31 |
32 | We then use this in our request calls:
33 |
34 | ```
35 | $options = array(
36 | 'auth' => new MySoftware_Auth_Hotdog('yummy')
37 | );
38 | $response = Requests::get('http://hotdogbin.org/admin', array(), $options);
39 | ```
40 |
41 | (For more information on how to register and use hooks, see the [hooking
42 | system documentation][hooks])
43 |
44 | [hooks]: hooks.md
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/authentication.md:
--------------------------------------------------------------------------------
1 | Authentication
2 | ==============
3 | Many requests that you make will require authentication of some type. Requests
4 | includes support out of the box for HTTP Basic authentication, with more
5 | built-ins coming soon.
6 |
7 | Making a Basic authenticated call is ridiculously easy:
8 |
9 | ```php
10 | $options = array(
11 | 'auth' => new Requests_Auth_Basic(array('user', 'password'))
12 | );
13 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options);
14 | ```
15 |
16 | As Basic authentication is usually what you want when you specify a username
17 | and password, you can also just pass in an array as a shorthand:
18 |
19 | ```php
20 | $options = array(
21 | 'auth' => array('user', 'password')
22 | );
23 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options);
24 | ```
25 |
26 | Note that POST/PUT can also take a data parameter, so you also need that
27 | before `$options`:
28 |
29 | ```php
30 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), null, $options);
31 | ```
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/goals.md:
--------------------------------------------------------------------------------
1 | Goals
2 | =====
3 |
4 | 1. **Simple interface**
5 |
6 | Requests is designed to provide a simple, unified interface to making
7 | requests, regardless of what is available on the system. This means not worrying.
8 |
9 | 2. **Fully tested code**
10 |
11 | Requests strives to have 90%+ code coverage from the unit tests, aiming for
12 | the ideal 100%. Introducing new features always means introducing new tests
13 |
14 | (Note: some parts of the code are not covered by design. These sections are
15 | marked with `@codeCoverageIgnore` tags)
16 |
17 | 3. **Maximum compatibility**
18 |
19 | No matter what you have installed on your system, you should be able to run
20 | Requests. We use cURL if it's available, and fallback to sockets otherwise.
21 | We require only a baseline of PHP 5.2, leaving the choice of PHP minimum
22 | requirement fully in your hands, and giving you the ability to support many
23 | more hosts.
24 |
25 | 4. **No dependencies**
26 |
27 | Requests is designed to be entirely self-contained and doesn't require
28 | anything else at all. You can run Requests on an entirely stock PHP build
29 | without any additional extensions outside the standard library.
30 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/hooks.md:
--------------------------------------------------------------------------------
1 | Hooks
2 | =====
3 | Requests has a hook system that you can use to manipulate parts of the request
4 | process along with internal transport hooks.
5 |
6 | Check out the [API documentation for `Requests_Hooks`][requests_hooks] for more
7 | information on how to use the hook system.
8 |
9 | Available Hooks
10 | ---------------
11 |
12 | * `requests.before_request`
13 |
14 | Alter the request before it's sent to the transport.
15 |
16 | Parameters: `string &$url`, `array &$headers`, `array|string &$data`,
17 | `string &$type`, `array &$options`
18 |
19 | * `requests.before_parse`
20 |
21 | Alter the raw HTTP response before parsing
22 |
23 | Parameters: `string &$response`
24 |
25 | * `requests.after_request`
26 |
27 | Alter the response object before it's returned to the user
28 |
29 | Parameters: `Requests_Response &$return`
30 |
31 | * `curl.before_request`
32 |
33 | Set cURL options before the transport sets any (note that Requests may
34 | override these)
35 |
36 | Parameters: `cURL resource &$fp`
37 |
38 | * `curl.before_send`
39 |
40 | Set cURL options just before the request is actually sent via `curl_exec`
41 |
42 | Parameters: `cURL resource &$fp`
43 |
44 | * `curl.after_request`
45 |
46 | Alter the raw HTTP response before returning for parsing
47 |
48 | Parameters: `string &$response`
49 |
50 | * `fsockopen.before_request`
51 |
52 | Run events before the transport does anything
53 |
54 | * `fsockopen.after_headers`
55 |
56 | Add extra headers before the body begins (i.e. before `\r\n\r\n`)
57 |
58 | Parameters: `string &$out`
59 |
60 | * `fsockopen.before_send`
61 |
62 | Add body data before sending the request
63 |
64 | Parameters: `string &$out`
65 |
66 | * `fsockopen.after_send`
67 |
68 | Run events after writing the data to the socket
69 |
70 | * `fsockopen.after_request`
71 |
72 | Alter the raw HTTP response before returning for parsing
73 |
74 | Parameters: `string &$response`
75 |
76 |
77 | Registering Hooks
78 | -----------------
79 | Note: if you're doing this in an authentication handler, see the [Custom
80 | Authentication guide][authentication-custom] instead.
81 |
82 | [authentication-custom]: authentication-custom.md
83 |
84 | In order to register your own hooks, you need to instantiate `Requests_hooks`
85 | and pass this in via the 'hooks' option.
86 |
87 | ```php
88 | $hooks = new Requests_Hooks();
89 | $hooks->register('requests.after_request', 'mycallback');
90 |
91 | $request = Requests::get('http://httpbin.org/get', array(), array('hooks' => $hooks));
92 | ```
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/proxy.md:
--------------------------------------------------------------------------------
1 | Proxy Support
2 | =============
3 |
4 | You can easily make requests through HTTP proxies.
5 |
6 | To make requests through an open proxy, specify the following options:
7 |
8 | ```php
9 | $options = array(
10 | 'proxy' => '127.0.0.1:3128'
11 | );
12 | Requests::get('http://httpbin.org/ip', array(), $options);
13 | ```
14 |
15 | If your proxy needs you to authenticate, the option will become an array like
16 | the following:
17 |
18 | ```php
19 | $options = array(
20 | 'proxy' => array( '127.0.0.1:3128', 'my_username', 'my_password' )
21 | );
22 | Requests::get('http://httpbin.org/ip', array(), $options);
23 | ```
24 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/usage-advanced.md:
--------------------------------------------------------------------------------
1 | Advanced Usage
2 | ==============
3 |
4 | Session Handling
5 | ----------------
6 | Making multiple requests to the same site with similar options can be a pain,
7 | since you end up repeating yourself. The Session object can be used to set
8 | default parameters for these.
9 |
10 | Let's simulate communicating with GitHub.
11 |
12 | ```php
13 | $session = new Requests_Session('https://api.github.com/');
14 | $session->headers['X-ContactAuthor'] = 'rmccue';
15 | $session->useragent = 'My-Awesome-App';
16 |
17 | $response = $session->get('/zen');
18 | ```
19 |
20 | You can use the `url`, `headers`, `data` and `options` properties of the Session
21 | object to set the defaults for this session, and the constructor also takes
22 | parameters in the same order as `Requests::request()`. Accessing any other
23 | properties will set the corresponding key in the options array; that is:
24 |
25 | ```php
26 | // Setting the property...
27 | $session->useragent = 'My-Awesome-App';
28 |
29 | // ...is the same as setting the option
30 | $session->options['useragent'] = 'My-Awesome-App';
31 | ```
32 |
33 |
34 | Secure Requests with SSL
35 | ------------------------
36 | By default, HTTPS requests will use the most secure options available:
37 |
38 | ```php
39 | $response = Requests::get('https://httpbin.org/');
40 | ```
41 |
42 | Requests bundles certificates from the [Mozilla certificate authority list][],
43 | which is the same list of root certificates used in most browsers. If you're
44 | accessing sites with certificates from other CAs, or self-signed certificates,
45 | you can point Requests to a custom CA list in PEM form (the same format
46 | accepted by cURL and OpenSSL):
47 |
48 | ```php
49 | $options = array(
50 | 'verify' => '/path/to/cacert.pem'
51 | );
52 | $response = Requests::get('https://httpbin.org/', array(), $options);
53 | ```
54 |
55 | Alternatively, if you want to disable verification completely, this is possible
56 | with `'verify' => false`, but note that this is extremely insecure and should be
57 | avoided.
58 |
59 | ### Security Note
60 | Requests supports SSL across both cURL and fsockopen in a transparent manner.
61 | Unlike other PHP HTTP libraries, support for verifying the certificate name is
62 | built-in; that is, a request for `https://github.com/` will actually verify the
63 | certificate's name even with the fsockopen transport. This makes Requests the
64 | first and currently only PHP HTTP library that supports full SSL verification.
65 |
66 | (Note that WordPress now also supports this verification, thanks to efforts by
67 | the Requests development team.)
68 |
69 | (See also the [related PHP][php-bug-47030] and [OpenSSL-related][php-bug-55820]
70 | bugs in PHP for more information on Subject Alternate Name field.)
71 |
72 | [Mozilla certificate authority list]: http://www.mozilla.org/projects/security/certs/
73 | [php-bug-47030]: https://bugs.php.net/bug.php?id=47030
74 | [php-bug-55820]:https://bugs.php.net/bug.php?id=55820
75 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/docs/usage.md:
--------------------------------------------------------------------------------
1 | Usage
2 | =====
3 |
4 | Ready to go? Make sure you have Requests installed before attempting any of the
5 | steps in this guide.
6 |
7 |
8 | Loading Requests
9 | ----------------
10 | Before we can load Requests up, we'll need to make sure it's loaded. This is a
11 | simple two-step:
12 |
13 | ```php
14 | // First, include Requests
15 | include('/path/to/library/Requests.php');
16 |
17 | // Next, make sure Requests can load internal classes
18 | Requests::register_autoloader();
19 | ```
20 |
21 | If you'd like to bring along your own autoloader, you can forget about this
22 | completely.
23 |
24 |
25 | Make a GET Request
26 | ------------------
27 | One of the most basic things you can do with HTTP is make a GET request.
28 |
29 | Let's grab GitHub's public timeline:
30 |
31 | ```php
32 | $response = Requests::get('https://github.com/timeline.json');
33 | ```
34 |
35 | `$response` is now a **Requests_Response** object. Response objects are what
36 | you'll be working with whenever you want to get data back from your request.
37 |
38 |
39 | Using the Response Object
40 | -------------------------
41 | Now that we have the response from GitHub, let's get the body of the response.
42 |
43 | ```php
44 | var_dump($response->body);
45 | // string(42865) "[{"repository":{"url":"...
46 | ```
47 |
48 |
49 | Custom Headers
50 | --------------
51 | If you want to add custom headers to the request, simply pass them in as an
52 | associative array as the second parameter:
53 |
54 | ```php
55 | $response = Requests::get('https://github.com/timeline.json', array('X-Requests' => 'Is Awesome!'));
56 | ```
57 |
58 |
59 | Make a POST Request
60 | -------------------
61 | Making a POST request is very similar to making a GET:
62 |
63 | ```php
64 | $response = Requests::post('http://httpbin.org/post');
65 | ```
66 |
67 | You'll probably also want to pass in some data. You can pass in either a
68 | string, an array or an object (Requests uses [`http_build_query`][build_query]
69 | internally) as the third parameter (after the URL and headers):
70 |
71 | [build_query]: http://php.net/http_build_query
72 |
73 | ```php
74 | $data = array('key1' => 'value1', 'key2' => 'value2');
75 | $response = Requests::post('http://httpbin.org/post', array(), $data);
76 | var_dump($response->body);
77 | ```
78 |
79 | This gives the output:
80 |
81 | string(503) "{
82 | "origin": "124.191.162.147",
83 | "files": {},
84 | "form": {
85 | "key2": "value2",
86 | "key1": "value1"
87 | },
88 | "headers": {
89 | "Content-Length": "23",
90 | "Accept-Encoding": "deflate;q=1.0, compress;q=0.5, gzip;q=0.5",
91 | "X-Forwarded-Port": "80",
92 | "Connection": "keep-alive",
93 | "User-Agent": "php-requests/1.6-dev",
94 | "Host": "httpbin.org",
95 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
96 | },
97 | "url": "http://httpbin.org/post",
98 | "args": {},
99 | "data": ""
100 | }"
101 |
102 | To send raw data, simply pass in a string instead. You'll probably also want to
103 | set the Content-Type header to ensure the remote server knows what you're
104 | sending it:
105 |
106 | ```php
107 | $url = 'https://api.github.com/some/endpoint';
108 | $headers = array('Content-Type' => 'application/json');
109 | $data = array('some' => 'data');
110 | $response = Requests::post($url, $headers, json_encode($data));
111 | ```
112 |
113 | Note that if you don't manually specify a Content-Type header, Requests has
114 | undefined behaviour for the header. It may be set to various values depending
115 | on the internal execution path, so it's recommended to set this explicitly if
116 | you need to.
117 |
118 |
119 | Status Codes
120 | ------------
121 | The Response object also gives you access to the status code:
122 |
123 | ```php
124 | var_dump($response->status_code);
125 | // int(200)
126 | ```
127 |
128 | You can also easily check if this status code is a success code, or if it's an
129 | error:
130 |
131 | ```php
132 | var_dump($response->success);
133 | // bool(true)
134 | ```
135 |
136 |
137 | Response Headers
138 | ----------------
139 | We can also grab headers pretty easily:
140 |
141 | ```php
142 | var_dump($response->headers['Date']);
143 | // string(29) "Thu, 09 Feb 2012 15:22:06 GMT"
144 | ```
145 |
146 | Note that this is case-insensitive, so the following are all equivalent:
147 |
148 | * `$response->headers['Date']`
149 | * `$response->headers['date']`
150 | * `$response->headers['DATE']`
151 | * `$response->headers['dAtE']`
152 |
153 | If a header isn't set, this will give `null`. You can also check with
154 | `isset($response->headers['date'])`
155 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/examples/basic-auth.php:
--------------------------------------------------------------------------------
1 | array('someuser', 'password')
12 | );
13 | $request = Requests::get('http://httpbin.org/basic-auth/someuser/password', array(), $options);
14 |
15 | // Check what we received
16 | var_dump($request);
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/examples/get.php:
--------------------------------------------------------------------------------
1 | 'application/json'));
11 |
12 | // Check what we received
13 | var_dump($request);
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/examples/multiple.php:
--------------------------------------------------------------------------------
1 | 'http://httpbin.org/get',
13 | 'headers' => array('Accept' => 'application/javascript'),
14 | ),
15 | 'post' => array(
16 | 'url' => 'http://httpbin.org/post',
17 | 'data' => array('mydata' => 'something'),
18 | ),
19 | 'delayed' => array(
20 | 'url' => 'http://httpbin.org/delay/10',
21 | 'options' => array(
22 | 'timeout' => 20,
23 | ),
24 | ),
25 | );
26 |
27 | // Setup a callback
28 | function my_callback(&$request, $id) {
29 | var_dump($id, $request);
30 | }
31 |
32 | // Tell Requests to use the callback
33 | $options = array(
34 | 'complete' => 'my_callback',
35 | );
36 |
37 | // Send the request!
38 | $responses = Requests::request_multiple($requests, $options);
39 |
40 | // Note: the response from the above call will be an associative array matching
41 | // $requests with the response data, however we've already handled it in
42 | // my_callback() anyway!
43 | //
44 | // If you don't believe me, uncomment this:
45 | # var_dump($responses);
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/examples/post.php:
--------------------------------------------------------------------------------
1 | 'something'));
11 |
12 | // Check what we received
13 | var_dump($request);
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/examples/proxy.php:
--------------------------------------------------------------------------------
1 | '127.0.0.1:8080', // syntax: host:port, eg 12.13.14.14:8080 or someproxy.com:3128
12 | // If you need to authenticate, use the following syntax:
13 | // 'proxy' => array( '127.0.0.1:8080', 'username', 'password' ),
14 | );
15 | $request = Requests::get('http://httpbin.org/ip', array(), $options );
16 |
17 | // See result
18 | var_dump($request->body);
19 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/examples/session.php:
--------------------------------------------------------------------------------
1 | headers['Accept'] = 'application/json';
12 | $session->useragent = 'Awesomesauce';
13 |
14 | // Now let's make a request!
15 | $request = $session->get('/get');
16 |
17 | // Check what we received
18 | var_dump($request);
19 |
20 | // Let's check our user agent!
21 | $request = $session->get('/user-agent');
22 |
23 | // And check again
24 | var_dump($request);
25 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Auth.php:
--------------------------------------------------------------------------------
1 | user, $this->pass) = $args;
46 | }
47 | }
48 |
49 | /**
50 | * Register the necessary callbacks
51 | *
52 | * @see curl_before_send
53 | * @see fsockopen_header
54 | * @param Requests_Hooks $hooks Hook system
55 | */
56 | public function register(Requests_Hooks &$hooks) {
57 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
58 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
59 | }
60 |
61 | /**
62 | * Set cURL parameters before the data is sent
63 | *
64 | * @param resource $handle cURL resource
65 | */
66 | public function curl_before_send(&$handle) {
67 | curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
68 | curl_setopt($handle, CURLOPT_USERPWD, $this->getAuthString());
69 | }
70 |
71 | /**
72 | * Add extra headers to the request before sending
73 | *
74 | * @param string $out HTTP header string
75 | */
76 | public function fsockopen_header(&$out) {
77 | $out .= "Authorization: Basic " . base64_encode($this->getAuthString()) . "\r\n";
78 | }
79 |
80 | /**
81 | * Get the authentication string (user:pass)
82 | *
83 | * @return string
84 | */
85 | public function getAuthString() {
86 | return $this->user . ':' . $this->pass;
87 | }
88 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Cookie.php:
--------------------------------------------------------------------------------
1 | name = $name;
46 | $this->value = $value;
47 | $this->attributes = $attributes;
48 | }
49 |
50 | /**
51 | * Format a cookie for a Cookie header
52 | *
53 | * This is used when sending cookies to a server.
54 | *
55 | * @return string Cookie formatted for Cookie header
56 | */
57 | public function formatForHeader() {
58 | return sprintf('%s=%s', $this->name, $this->value);
59 | }
60 |
61 | /**
62 | * Format a cookie for a Set-Cookie header
63 | *
64 | * This is used when sending cookies to clients. This isn't really
65 | * applicable to client-side usage, but might be handy for debugging.
66 | *
67 | * @return string Cookie formatted for Set-Cookie header
68 | */
69 | public function formatForSetCookie() {
70 | $header_value = $this->formatForHeader();
71 | if (!empty($this->attributes)) {
72 | $parts = array();
73 | foreach ($this->attributes as $key => $value) {
74 | // Ignore non-associative attributes
75 | if (is_numeric($key)) {
76 | $parts[] = $value;
77 | }
78 | else {
79 | $parts[] = sprintf('%s=%s', $key, $value);
80 | }
81 | }
82 |
83 | $header_value .= '; ' . implode('; ', $parts);
84 | }
85 | return $header_value;
86 | }
87 |
88 | /**
89 | * Get the cookie value
90 | *
91 | * Attributes and other data can be accessed via methods.
92 | */
93 | public function __toString() {
94 | return $this->value;
95 | }
96 |
97 | /**
98 | * Parse a cookie string into a cookie object
99 | *
100 | * Based on Mozilla's parsing code in Firefox and related projects, which
101 | * is an intentional deviation from RFC 2109 and RFC 2616. RFC 6265
102 | * specifies some of this handling, but not in a thorough manner.
103 | *
104 | * @param string Cookie header value (from a Set-Cookie header)
105 | * @return Requests_Cookie Parsed cookie object
106 | */
107 | public static function parse($string, $name = '') {
108 | $parts = explode(';', $string);
109 | $kvparts = array_shift($parts);
110 |
111 | if (!empty($name)) {
112 | $value = $string;
113 | }
114 | elseif (strpos($kvparts, '=') === false) {
115 | // Some sites might only have a value without the equals separator.
116 | // Deviate from RFC 6265 and pretend it was actually a blank name
117 | // (`=foo`)
118 | //
119 | // https://bugzilla.mozilla.org/show_bug.cgi?id=169091
120 | $name = '';
121 | $value = $kvparts;
122 | }
123 | else {
124 | list($name, $value) = explode('=', $kvparts, 2);
125 | }
126 | $name = trim($name);
127 | $value = trim($value);
128 |
129 | // Attribute key are handled case-insensitively
130 | $attributes = new Requests_Utility_CaseInsensitiveDictionary();
131 |
132 | if (!empty($parts)) {
133 | foreach ($parts as $part) {
134 | if (strpos($part, '=') === false) {
135 | $part_key = $part;
136 | $part_value = true;
137 | }
138 | else {
139 | list($part_key, $part_value) = explode('=', $part, 2);
140 | $part_value = trim($part_value);
141 | }
142 |
143 | $part_key = trim($part_key);
144 | $attributes[$part_key] = $part_value;
145 | }
146 | }
147 |
148 | return new Requests_Cookie($name, $value, $attributes);
149 | }
150 |
151 | /**
152 | * Parse all Set-Cookie headers from request headers
153 | *
154 | * @param Requests_Response_Headers $headers
155 | * @return array
156 | */
157 | public static function parseFromHeaders(Requests_Response_Headers $headers) {
158 | $cookie_headers = $headers->getValues('Set-Cookie');
159 | if (empty($cookie_headers)) {
160 | return array();
161 | }
162 |
163 | $cookies = array();
164 | foreach ($cookie_headers as $header) {
165 | $parsed = self::parse($header);
166 | $cookies[$parsed->name] = $parsed;
167 | }
168 |
169 | return $cookies;
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Cookie/Jar.php:
--------------------------------------------------------------------------------
1 | cookies = $cookies;
30 | }
31 |
32 | /**
33 | * Normalise cookie data into a Requests_Cookie
34 | *
35 | * @param string|Requests_Cookie $cookie
36 | * @return Requests_Cookie
37 | */
38 | public function normalizeCookie($cookie, $key = null) {
39 | if ($cookie instanceof Requests_Cookie) {
40 | return $cookie;
41 | }
42 |
43 | return Requests_Cookie::parse($cookie, $key);
44 | }
45 |
46 | /**
47 | * Check if the given item exists
48 | *
49 | * @param string $key Item key
50 | * @return boolean Does the item exist?
51 | */
52 | public function offsetExists($key) {
53 | return isset($this->cookies[$key]);
54 | }
55 |
56 | /**
57 | * Get the value for the item
58 | *
59 | * @param string $key Item key
60 | * @return string Item value
61 | */
62 | public function offsetGet($key) {
63 | if (!isset($this->cookies[$key]))
64 | return null;
65 |
66 | return $this->cookies[$key];
67 | }
68 |
69 | /**
70 | * Set the given item
71 | *
72 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`)
73 | *
74 | * @param string $key Item name
75 | * @param string $value Item value
76 | */
77 | public function offsetSet($key, $value) {
78 | if ($key === null) {
79 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
80 | }
81 |
82 | $this->cookies[$key] = $value;
83 | }
84 |
85 | /**
86 | * Unset the given header
87 | *
88 | * @param string $key
89 | */
90 | public function offsetUnset($key) {
91 | unset($this->cookies[$key]);
92 | }
93 |
94 | /**
95 | * Get an iterator for the data
96 | *
97 | * @return ArrayIterator
98 | */
99 | public function getIterator() {
100 | return new ArrayIterator($this->cookies);
101 | }
102 |
103 | /**
104 | * Register the cookie handler with the request's hooking system
105 | *
106 | * @param Requests_Hooker $hooks Hooking system
107 | */
108 | public function register(Requests_Hooker $hooks) {
109 | $hooks->register('requests.before_request', array($this, 'before_request'));
110 | $hooks->register('requests.before_redirect_check', array($this, 'before_redirect_check'));
111 | }
112 |
113 | /**
114 | * Add Cookie header to a request if we have any
115 | *
116 | * As per RFC 6265, cookies are separated by '; '
117 | *
118 | * @param string $url
119 | * @param array $headers
120 | * @param array $data
121 | * @param string $type
122 | * @param array $options
123 | */
124 | public function before_request(&$url, &$headers, &$data, &$type, &$options) {
125 | if (!empty($this->cookies)) {
126 | $cookies = array();
127 | foreach ($this->cookies as $key => $cookie) {
128 | $cookie = $this->normalizeCookie($cookie, $key);
129 | $cookies[] = $cookie->formatForHeader();
130 | }
131 |
132 | $headers['Cookie'] = implode('; ', $cookies);
133 | }
134 | }
135 |
136 | /**
137 | * Parse all cookies from a response and attach them to the response
138 | *
139 | * @var Requests_Response $response
140 | */
141 | public function before_redirect_check(Requests_Response &$return) {
142 | $cookies = Requests_Cookie::parseFromHeaders($return->headers);
143 | $this->cookies = array_merge($this->cookies, $cookies);
144 | $return->cookies = $this;
145 | }
146 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Exception.php:
--------------------------------------------------------------------------------
1 | type = $type;
40 | $this->data = $data;
41 | }
42 |
43 | /**
44 | * Like {@see getCode()}, but a string code.
45 | *
46 | * @codeCoverageIgnore
47 | * @return string
48 | */
49 | public function getType() {
50 | return $this->type;
51 | }
52 |
53 | /**
54 | * Gives any relevant data
55 | *
56 | * @codeCoverageIgnore
57 | * @return mixed
58 | */
59 | public function getData() {
60 | return $this->data;
61 | }
62 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Exception/HTTP.php:
--------------------------------------------------------------------------------
1 | reason = $reason;
40 | }
41 |
42 | $message = sprintf('%d %s', $this->code, $this->reason);
43 | parent::__construct($message, 'httpresponse', $data, $this->code);
44 | }
45 |
46 | /**
47 | * Get the status message
48 | */
49 | public function getReason() {
50 | return $this->reason;
51 | }
52 |
53 | /**
54 | * Get the correct exception class for a given error code
55 | *
56 | * @param int $code HTTP status code
57 | * @return string Exception class name to use
58 | */
59 | public static function get_class($code) {
60 | $class = sprintf('Requests_Exception_HTTP_%d', $code);
61 | if (class_exists($class)) {
62 | return $class;
63 | }
64 |
65 | return 'Requests_Exception_HTTP_Unknown';
66 | }
67 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Exception/HTTP/400.php:
--------------------------------------------------------------------------------
1 | code = $data->status_code;
40 | }
41 |
42 | parent::__construct($reason, $data);
43 | }
44 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Hooker.php:
--------------------------------------------------------------------------------
1 | 0 is executed later
22 | */
23 | public function register($hook, $callback, $priority = 0);
24 |
25 | /**
26 | * Dispatch a message
27 | *
28 | * @param string $hook Hook name
29 | * @param array $parameters Parameters to pass to callbacks
30 | * @return boolean Successfulness
31 | */
32 | public function dispatch($hook, $parameters = array());
33 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Hooks.php:
--------------------------------------------------------------------------------
1 | 0 is executed later
29 | */
30 | public function register($hook, $callback, $priority = 0) {
31 | if (!isset($this->hooks[$hook])) {
32 | $this->hooks[$hook] = array();
33 | }
34 | if (!isset($this->hooks[$hook][$priority])) {
35 | $this->hooks[$hook][$priority] = array();
36 | }
37 |
38 | $this->hooks[$hook][$priority][] = $callback;
39 | }
40 |
41 | /**
42 | * Dispatch a message
43 | *
44 | * @param string $hook Hook name
45 | * @param array $parameters Parameters to pass to callbacks
46 | * @return boolean Successfulness
47 | */
48 | public function dispatch($hook, $parameters = array()) {
49 | if (empty($this->hooks[$hook])) {
50 | return false;
51 | }
52 |
53 | foreach ($this->hooks[$hook] as $priority => $hooked) {
54 | foreach ($hooked as $callback) {
55 | call_user_func_array($callback, $parameters);
56 | }
57 | }
58 |
59 | return true;
60 | }
61 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Proxy.php:
--------------------------------------------------------------------------------
1 | proxy = $args;
60 | }
61 | elseif (is_array($args)) {
62 | if (count($args) == 1) {
63 | list($this->proxy) = $args;
64 | }
65 | elseif (count($args) == 3) {
66 | list($this->proxy, $this->user, $this->pass) = $args;
67 | $this->use_authentication = true;
68 | }
69 | else {
70 | throw new Requests_Exception( 'Invalid number of arguments', 'proxyhttpbadargs');
71 | }
72 | }
73 | }
74 |
75 | /**
76 | * Register the necessary callbacks
77 | *
78 | * @since 1.6
79 | * @see curl_before_send
80 | * @see fsockopen_remote_socket
81 | * @see fsockopen_remote_host_path
82 | * @see fsockopen_header
83 | * @param Requests_Hooks $hooks Hook system
84 | */
85 | public function register(Requests_Hooks &$hooks) {
86 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
87 |
88 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket'));
89 | $hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path'));
90 | if( $this->use_authentication ) {
91 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
92 | }
93 | }
94 |
95 | /**
96 | * Set cURL parameters before the data is sent
97 | *
98 | * @since 1.6
99 | * @param resource $handle cURL resource
100 | */
101 | public function curl_before_send(&$handle) {
102 | curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
103 | curl_setopt($handle, CURLOPT_PROXY, $this->proxy);
104 |
105 | if ($this->use_authentication) {
106 | curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
107 | curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string());
108 | }
109 | }
110 |
111 | /**
112 | * Alter remote socket information before opening socket connection
113 | *
114 | * @since 1.6
115 | * @param string $out HTTP header string
116 | */
117 | public function fsockopen_remote_socket( &$remote_socket ) {
118 | $remote_socket = $this->proxy;
119 | }
120 |
121 | /**
122 | * Alter remote path before getting stream data
123 | *
124 | * @since 1.6
125 | * @param string $out HTTP header string
126 | */
127 | public function fsockopen_remote_host_path( &$path, $url ) {
128 | $path = $url;
129 | }
130 |
131 | /**
132 | * Add extra headers to the request before sending
133 | *
134 | * @since 1.6
135 | * @param string $out HTTP header string
136 | */
137 | public function fsockopen_header( &$out ) {
138 | $out .= "Proxy-Authorization: Basic " . base64_encode($this->get_auth_string()) . "\r\n";
139 | }
140 |
141 | /**
142 | * Get the authentication string (user:pass)
143 | *
144 | * @since 1.6
145 | * @return string
146 | */
147 | public function get_auth_string() {
148 | return $this->user . ':' . $this->pass;
149 | }
150 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Response.php:
--------------------------------------------------------------------------------
1 | headers = new Requests_Response_Headers();
21 | }
22 |
23 | /**
24 | * Response body
25 | * @var string
26 | */
27 | public $body = '';
28 |
29 | /**
30 | * Raw HTTP data from the transport
31 | * @var string
32 | */
33 | public $raw = '';
34 |
35 | /**
36 | * Headers, as an associative array
37 | * @var array
38 | */
39 | public $headers = array();
40 |
41 | /**
42 | * Status code, false if non-blocking
43 | * @var integer|boolean
44 | */
45 | public $status_code = false;
46 |
47 | /**
48 | * Whether the request succeeded or not
49 | * @var boolean
50 | */
51 | public $success = false;
52 |
53 | /**
54 | * Number of redirects the request used
55 | * @var integer
56 | */
57 | public $redirects = 0;
58 |
59 | /**
60 | * URL requested
61 | * @var string
62 | */
63 | public $url = '';
64 |
65 | /**
66 | * Previous requests (from redirects)
67 | * @var array Array of Requests_Response objects
68 | */
69 | public $history = array();
70 |
71 | /**
72 | * Cookies from the request
73 | */
74 | public $cookies = array();
75 |
76 | /**
77 | * Throws an exception if the request was not successful
78 | *
79 | * @throws Requests_Exception If `$allow_redirects` is false, and code is 3xx (`response.no_redirects`)
80 | * @throws Requests_Exception_HTTP On non-successful status code. Exception class corresponds to code (e.g. {@see Requests_Exception_HTTP_404})
81 | * @param boolean $allow_redirects Set to false to throw on a 3xx as well
82 | */
83 | public function throw_for_status($allow_redirects = true) {
84 | if ($this->status_code >= 300 && $this->status_code < 400) {
85 | if (!$allow_redirects) {
86 | throw new Requests_Exception('Redirection not allowed', 'response.no_redirects', $this);
87 | }
88 | }
89 |
90 | elseif (!$this->success) {
91 | $exception = Requests_Exception_HTTP::get_class($this->status_code);
92 | throw new $exception(null, $this);
93 | }
94 | }
95 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Response/Headers.php:
--------------------------------------------------------------------------------
1 | data[$key]))
29 | return null;
30 |
31 | return $this->flatten($this->data[$key]);
32 | }
33 |
34 | /**
35 | * Set the given item
36 | *
37 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`)
38 | *
39 | * @param string $key Item name
40 | * @param string $value Item value
41 | */
42 | public function offsetSet($key, $value) {
43 | if ($key === null) {
44 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
45 | }
46 |
47 | $key = strtolower($key);
48 |
49 | if (!isset($this->data[$key])) {
50 | $this->data[$key] = array();
51 | }
52 |
53 | $this->data[$key][] = $value;
54 | }
55 |
56 | /**
57 | * Get all values for a given header
58 | *
59 | * @param string $key
60 | * @return array Header values
61 | */
62 | public function getValues($key) {
63 | $key = strtolower($key);
64 | if (!isset($this->data[$key]))
65 | return null;
66 |
67 | return $this->data[$key];
68 | }
69 |
70 | /**
71 | * Flattens a value into a string
72 | *
73 | * Converts an array into a string by imploding values with a comma, as per
74 | * RFC2616's rules for folding headers.
75 | *
76 | * @param string|array $value Value to flatten
77 | * @return string Flattened value
78 | */
79 | public function flatten($value) {
80 | if (is_array($value))
81 | $value = implode(',', $value);
82 |
83 | return $value;
84 | }
85 |
86 | /**
87 | * Get an iterator for the data
88 | *
89 | * Converts the internal
90 | * @return ArrayIterator
91 | */
92 | public function getIterator() {
93 | return new Requests_Utility_FilteredIterator($this->data, array($this, 'flatten'));
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/SSL.php:
--------------------------------------------------------------------------------
1 | data[$key]);
32 | }
33 |
34 | /**
35 | * Get the value for the item
36 | *
37 | * @param string $key Item key
38 | * @return string Item value
39 | */
40 | public function offsetGet($key) {
41 | $key = strtolower($key);
42 | if (!isset($this->data[$key]))
43 | return null;
44 |
45 | return $this->data[$key];
46 | }
47 |
48 | /**
49 | * Set the given item
50 | *
51 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`)
52 | *
53 | * @param string $key Item name
54 | * @param string $value Item value
55 | */
56 | public function offsetSet($key, $value) {
57 | if ($key === null) {
58 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
59 | }
60 |
61 | $key = strtolower($key);
62 | $this->data[$key] = $value;
63 | }
64 |
65 | /**
66 | * Unset the given header
67 | *
68 | * @param string $key
69 | */
70 | public function offsetUnset($key) {
71 | unset($this->data[strtolower($key)]);
72 | }
73 |
74 | /**
75 | * Get an iterator for the data
76 | *
77 | * @return ArrayIterator
78 | */
79 | public function getIterator() {
80 | return new ArrayIterator($this->data);
81 | }
82 |
83 | /**
84 | * Get the headers as an array
85 | *
86 | * @return array Header data
87 | */
88 | public function getAll() {
89 | return $this->data;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/library/Requests/Utility/FilteredIterator.php:
--------------------------------------------------------------------------------
1 | callback = $callback;
26 | }
27 |
28 | /**
29 | * Get the current item's value after filtering
30 | *
31 | * @return string
32 | */
33 | public function current() {
34 | $value = parent::current();
35 | $value = call_user_func($this->callback, $value);
36 | return $value;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/package.xml.tpl:
--------------------------------------------------------------------------------
1 |
2 |
8 | Requests
9 | pear.ryanmccue.info
10 | A HTTP library written in PHP, for human beings.
11 |
12 | Requests is a HTTP library written in PHP, for human beings. It is
13 | roughly based on the API from the excellent Requests Python library.
14 | Requests is ISC Licensed (similar to the new BSD license) and has
15 | no dependencies.
16 |
17 |
18 | Ryan McCue
19 | rmccue
20 | me+pear@ryanmccue dot info
21 | yes
22 |
23 | {{ date }}
24 |
25 |
26 | {{ version }}
27 | {{ api_version }}
28 |
29 |
30 | {{ stability }}
31 | {{ stability }}
32 |
33 | ISC
34 | -
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | {{ files }}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 5.2.0
53 |
54 |
55 | 1.4.0
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/tests/Auth/Basic.php:
--------------------------------------------------------------------------------
1 | markTestSkipped($transport . ' is not available');
18 | return;
19 | }
20 |
21 | $options = array(
22 | 'auth' => array('user', 'passwd'),
23 | 'transport' => $transport,
24 | );
25 | $request = Requests::get('http://httpbin.org/basic-auth/user/passwd', array(), $options);
26 | $this->assertEquals(200, $request->status_code);
27 |
28 | $result = json_decode($request->body);
29 | $this->assertEquals(true, $result->authenticated);
30 | $this->assertEquals('user', $result->user);
31 | }
32 |
33 | /**
34 | * @dataProvider transportProvider
35 | */
36 | public function testUsingInstantiation($transport) {
37 | if (!call_user_func(array($transport, 'test'))) {
38 | $this->markTestSkipped($transport . ' is not available');
39 | return;
40 | }
41 |
42 | $options = array(
43 | 'auth' => new Requests_Auth_Basic(array('user', 'passwd')),
44 | 'transport' => $transport,
45 | );
46 | $request = Requests::get('http://httpbin.org/basic-auth/user/passwd', array(), $options);
47 | $this->assertEquals(200, $request->status_code);
48 |
49 | $result = json_decode($request->body);
50 | $this->assertEquals(true, $result->authenticated);
51 | $this->assertEquals('user', $result->user);
52 | }
53 |
54 | /**
55 | * @dataProvider transportProvider
56 | */
57 | public function testPOSTUsingInstantiation($transport) {
58 | if (!call_user_func(array($transport, 'test'))) {
59 | $this->markTestSkipped($transport . ' is not available');
60 | return;
61 | }
62 |
63 | $options = array(
64 | 'auth' => new Requests_Auth_Basic(array('user', 'passwd')),
65 | 'transport' => $transport,
66 | );
67 | $data = 'test';
68 | $request = Requests::post('http://httpbin.org/post', array(), $data, $options);
69 | $this->assertEquals(200, $request->status_code);
70 |
71 | $result = json_decode($request->body);
72 |
73 | $auth = $result->headers->Authorization;
74 | $auth = explode(' ', $auth);
75 |
76 | $this->assertEquals(base64_encode('user:passwd'), $auth[1]);
77 | $this->assertEquals('test', $result->data);
78 | }
79 |
80 | /**
81 | * @expectedException Requests_Exception
82 | */
83 | public function testMissingPassword() {
84 | $auth = new Requests_Auth_Basic(array('user'));
85 | }
86 |
87 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/tests/ChunkedEncoding.php:
--------------------------------------------------------------------------------
1 | body = $body;
27 | $transport->chunked = true;
28 |
29 | $options = array(
30 | 'transport' => $transport
31 | );
32 | $response = Requests::get('http://example.com/', array(), $options);
33 |
34 | $this->assertEquals($expected, $response->body);
35 | }
36 |
37 | /**
38 | * Response says it's chunked, but actually isn't
39 | */
40 | public function testNotActuallyChunked() {
41 | $transport = new MockTransport();
42 | $transport->body = 'Hello! This is a non-chunked response!';
43 | $transport->chunked = true;
44 |
45 | $options = array(
46 | 'transport' => $transport
47 | );
48 | $response = Requests::get('http://example.com/', array(), $options);
49 |
50 | $this->assertEquals($transport->body, $response->body);
51 | }
52 |
53 | /**
54 | * Response says it's chunked and starts looking like it is, but turns out
55 | * that they're lying to us
56 | */
57 | public function testMixedChunkiness() {
58 | $transport = new MockTransport();
59 | $transport->body = "02\r\nab\r\nNot actually chunked!";
60 | $transport->chunked = true;
61 |
62 | $options = array(
63 | 'transport' => $transport
64 | );
65 | $response = Requests::get('http://example.com/', array(), $options);
66 | $this->assertEquals($transport->body, $response->body);
67 | }
68 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/tests/Encoding.php:
--------------------------------------------------------------------------------
1 | $set) {
66 | $real_set = self::mapData($key, $set);
67 | $data = array_merge($data, $real_set);
68 | }
69 | return $data;
70 | }
71 |
72 | /**
73 | * @dataProvider encodedData
74 | */
75 | public function testDecompress($original, $encoded) {
76 | $decoded = Requests::decompress($encoded);
77 | $this->assertEquals($original, $decoded);
78 | }
79 |
80 | /**
81 | * @dataProvider encodedData
82 | */
83 | public function testCompatibleInflate($original, $encoded) {
84 | $decoded = Requests::compatible_gzinflate($encoded);
85 | $this->assertEquals($original, $decoded);
86 | }
87 |
88 | protected function bin2hex($field) {
89 | $field = bin2hex($field);
90 | $field = chunk_split($field,2,"\\x");
91 | $field = "\\x" . substr($field,0,-2);
92 | return $field;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/tests/IDNAEncoder.php:
--------------------------------------------------------------------------------
1 | assertEquals($expected, $result);
23 | }
24 |
25 | /**
26 | * @expectedException Requests_Exception
27 | */
28 | public function testASCIITooLong() {
29 | $data = str_repeat("abcd", 20);
30 | $result = Requests_IDNAEncoder::encode($data);
31 | }
32 |
33 | /**
34 | * @expectedException Requests_Exception
35 | */
36 | public function testEncodedTooLong() {
37 | $data = str_repeat("\xe4\xbb\x96", 60);
38 | $result = Requests_IDNAEncoder::encode($data);
39 | }
40 |
41 | /**
42 | * @expectedException Requests_Exception
43 | */
44 | public function testAlreadyPrefixed() {
45 | $result = Requests_IDNAEncoder::encode("xn--\xe4\xbb\x96");
46 | }
47 |
48 | public function testASCIICharacter() {
49 | $result = Requests_IDNAEncoder::encode("a");
50 | $this->assertEquals('a', $result);
51 | }
52 |
53 | public function testTwoByteCharacter() {
54 | $result = Requests_IDNAEncoder::encode("\xc2\xb6"); // Pilcrow character
55 | $this->assertEquals('xn--tba', $result);
56 | }
57 |
58 | public function testThreeByteCharacter() {
59 | $result = Requests_IDNAEncoder::encode("\xe2\x82\xac"); // Euro symbol
60 | $this->assertEquals('xn--lzg', $result);
61 | }
62 |
63 | public function testFourByteCharacter() {
64 | $result = Requests_IDNAEncoder::encode("\xf0\xa4\xad\xa2"); // Chinese symbol?
65 | $this->assertEquals('xn--ww6j', $result);
66 | }
67 |
68 | /**
69 | * @expectedException Requests_Exception
70 | */
71 | public function testFiveByteCharacter() {
72 | $result = Requests_IDNAEncoder::encode("\xfb\xb6\xb6\xb6\xb6");
73 | }
74 |
75 | /**
76 | * @expectedException Requests_Exception
77 | */
78 | public function testSixByteCharacter() {
79 | $result = Requests_IDNAEncoder::encode("\xfd\xb6\xb6\xb6\xb6\xb6");
80 | }
81 |
82 | /**
83 | * @expectedException Requests_Exception
84 | */
85 | public function testInvalidASCIICharacterWithMultibyte() {
86 | $result = Requests_IDNAEncoder::encode("\0\xc2\xb6");
87 | }
88 |
89 | /**
90 | * @expectedException Requests_Exception
91 | */
92 | public function testUnfinishedMultibyte() {
93 | $result = Requests_IDNAEncoder::encode("\xc2");
94 | }
95 |
96 | /**
97 | * @expectedException Requests_Exception
98 | */
99 | public function testPartialMultibyte() {
100 | $result = Requests_IDNAEncoder::encode("\xc2\xc2\xb6");
101 | }
102 | }
--------------------------------------------------------------------------------
/razor/razorpay-php/libs/Requests-1.6.1/tests/Requests.php:
--------------------------------------------------------------------------------
1 | assertEquals(200, $request->status_code);
14 | }
15 |
16 | /**
17 | * Standard response header parsing
18 | */
19 | public function testHeaderParsing() {
20 | $transport = new RawTransport();
21 | $transport->data =
22 | "HTTP/1.0 200 OK\r\n".
23 | "Host: localhost\r\n".
24 | "Host: ambiguous\r\n".
25 | "Nospace:here\r\n".
26 | "Muchspace: there \r\n".
27 | "Empty:\r\n".
28 | "Empty2: \r\n".
29 | "Folded: one\r\n".
30 | "\ttwo\r\n".
31 | " three\r\n\r\n".
32 | "stop\r\n";
33 |
34 | $options = array(
35 | 'transport' => $transport
36 | );
37 | $response = Requests::get('http://example.com/', array(), $options);
38 | $expected = new Requests_Response_Headers();
39 | $expected['host'] = 'localhost,ambiguous';
40 | $expected['nospace'] = 'here';
41 | $expected['muchspace'] = 'there';
42 | $expected['empty'] = '';
43 | $expected['empty2'] = '';
44 | $expected['folded'] = 'one two three';
45 | foreach ($expected as $key => $value) {
46 | $this->assertEquals($value, $response->headers[$key]);
47 | }
48 |
49 | foreach ($response->headers as $key => $value) {
50 | $this->assertEquals($value, $expected[$key]);
51 | }
52 | }
53 |
54 | public function testRawAccess() {
55 | $transport = new RawTransport();
56 | $transport->data =
57 | "HTTP/1.0 200 OK\r\n".
58 | "Host: localhost\r\n\r\n".
59 | "Test";
60 |
61 | $options = array(
62 | 'transport' => $transport
63 | );
64 | $response = Requests::get('http://example.com/', array(), $options);
65 | $this->assertEquals($transport->data, $response->raw);
66 | }
67 |
68 | /**
69 | * Headers with only \n delimiting should be treated as if they're \r\n
70 | */
71 | public function testHeaderOnlyLF() {
72 | $transport = new RawTransport();
73 | $transport->data = "HTTP/1.0 200 OK\r\nTest: value\nAnother-Test: value\r\n\r\n";
74 |
75 | $options = array(
76 | 'transport' => $transport
77 | );
78 | $response = Requests::get('http://example.com/', array(), $options);
79 | $this->assertEquals('value', $response->headers['test']);
80 | $this->assertEquals('value', $response->headers['another-test']);
81 | }
82 |
83 | /**
84 | * Check that invalid protocols are not accepted
85 | *
86 | * We do not support HTTP/0.9. If this is really an issue for you, file a
87 | * new issue, and update your server/proxy to support a proper protocol.
88 | *
89 | * @expectedException Requests_Exception
90 | */
91 | public function testInvalidProtocolVersion() {
92 | $transport = new RawTransport();
93 | $transport->data = "HTTP/0.9 200 OK\r\n\r\n
Test";
94 |
95 | $options = array(
96 | 'transport' => $transport
97 | );
98 | $response = Requests::get('http://example.com/', array(), $options);
99 | }
100 |
101 | /**
102 | * HTTP/0.9 also appears to use a single CRLF instead of two
103 | *
104 | * @expectedException Requests_Exception
105 | */
106 | public function testSingleCRLFSeparator() {
107 | $transport = new RawTransport();
108 | $transport->data = "HTTP/0.9 200 OK\r\n