-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dcb31a5
Showing
78 changed files
with
10,834 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
nbproject/private | ||
*~ | ||
composer.lock | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: php | ||
php: | ||
- "5.6" | ||
- "5.5" | ||
- "5.4" | ||
|
||
install: | ||
- composer install | ||
|
||
script: | ||
- cd tests | ||
- phpunit -v --bootstrap bootstrap.php src/WebRequestTest.php | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Joao Gilberto Magalhaes | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Web Request | ||
[](https://travis-ci.org/byjg/webrequest) | ||
[](https://drone.io/github.com/byjg/webrequest/latest) | ||
[](https://insight.sensiolabs.com/projects/7cfbd581-fdb6-405d-be0a-afee0f70d30c) | ||
|
||
## Description | ||
|
||
A lightweight and highly customized CURL wrapper for making RESt calls and a wrapper for call dynamically SOAP requests. | ||
Just one class and no dependencies. | ||
|
||
## Examples | ||
|
||
### Basic Usage | ||
|
||
```php | ||
$webRequest = new WebRequest('http://www.example.com/page'); | ||
$result = $webRequest->get(); | ||
//$result = $webRequest->post(); | ||
//$result = $webRequest->delete(); | ||
//$result = $webRequest->put(); | ||
``` | ||
|
||
### Passing arguments | ||
|
||
```php | ||
$webRequest = new WebRequest('http://www.example.com/page'); | ||
$result = $webRequest->get(['param'=>'value']); | ||
//$result = $webRequest->post(['param'=>'value']); | ||
//$result = $webRequest->delete(['param'=>'value']); | ||
//$result = $webRequest->put(['param'=>'value']); | ||
``` | ||
|
||
### Passing a string payload (JSON) | ||
|
||
```php | ||
$webRequest = new WebRequest('http://www.example.com/page'); | ||
$result = $webRequest->postPayload('{teste: "value"}', 'application/json'); | ||
//$result = $webRequest->putPayload('{teste: "value"}', 'application/json'); | ||
//$result = $webRequest->deletePayload('{teste: "value"}', 'application/json'); | ||
``` | ||
|
||
### Setting Custom CURL PARAMETER | ||
|
||
```php | ||
$webRequest = new WebRequest('http://www.example.com/page'); | ||
$webRequest->setCurlOption(CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'); | ||
$result = $webRequest->get(); | ||
``` | ||
|
||
### Calling Soap Classes | ||
|
||
```php | ||
$webRequest = new WebRequest('http://www.example.com/soap'); | ||
$resutl = $webRequest->soapCall('soapMethod', ['arg1' => 'value']); | ||
``` | ||
|
||
|
||
## Install | ||
|
||
Just type: `composer install "byjg/webrequest=1.0.0"` | ||
|
||
## Running Tests | ||
|
||
### Starting the server | ||
|
||
```php | ||
cd tests | ||
php -S localhost:8080 -t server & | ||
``` | ||
|
||
**Note:** It is more assertive create a webserver with the server folder instead to use the PHP built-in webserver. | ||
|
||
### Running the integration tests | ||
|
||
```php | ||
cd tests | ||
phpunit --bootstrap bootstrap.php src/WebRequestTest.php | ||
``` | ||
|
||
### Stopping the server | ||
|
||
```php | ||
killall -9 php | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "byjg/anydataset", | ||
"description": "A data abstration layer in PHP with several repository types and standartize interface to operate it", | ||
"authors": [ | ||
{ | ||
"name": "João Gilberto Magalhães", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"ByJG\\AnyDataset\\": "src/", | ||
"Tests\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=5.4.0", | ||
"byjg/xmlutil": "~1.0", | ||
"byjg/sparqllib": "dev-master", | ||
"neitanod/forceutf8": "dev-master" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
require "vendor/autoload.php"; | ||
|
||
$webRequest = new \ByJG\Util\WebRequest('http://www.byjg.com.br/ws/cep'); | ||
|
||
echo $webRequest->get([ | ||
'httpmethod' => 'obterVersao' | ||
]) . "\n"; | ||
|
||
echo $webRequest->post([ | ||
'httpmethod' => 'obterLogradouro', | ||
'cep' => '30130000' | ||
]) . "\n"; | ||
|
||
echo $webRequest->soapCall('obterLogradouro', ['cep' => '30130000']) . "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_create_2e_tests=false | ||
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_enabled=true | ||
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_path=tests/bootstrap.php | ||
auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_enabled=false | ||
auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_path= | ||
auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_enabled=false | ||
auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_path= | ||
auxiliary.org-netbeans-modules-php-phpunit.phpUnit_2e_enabled=false | ||
auxiliary.org-netbeans-modules-php-phpunit.phpUnit_2e_path= | ||
auxiliary.org-netbeans-modules-php-phpunit.test_2e_groups_2e_ask=false | ||
auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_all=false | ||
file.reference.anydataset-tests=tests | ||
include.path=${php.global.include.path} | ||
php.version=PHP_54 | ||
source.encoding=UTF-8 | ||
src.dir=. | ||
tags.asp=false | ||
tags.short=false | ||
test.src.dir=${file.reference.anydataset-tests} | ||
testing.providers=PhpUnit | ||
web.root=. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://www.netbeans.org/ns/project/1"> | ||
<type>org.netbeans.modules.php.project</type> | ||
<configuration> | ||
<data xmlns="http://www.netbeans.org/ns/php-project/1"> | ||
<name>anydataset</name> | ||
</data> | ||
</configuration> | ||
</project> |
Oops, something went wrong.