All PHP standalone scripts
Class
- API Class Call REST Api using php cURL Extension
- CookieTraits Use to check whether browser cookie is enabled. You may use for storing, getting, destroying the cookies by name
Im using http://www.binlist.net/ web service (REST API) to check the bank identification number.
$format = 'json'; //format can be (json, xml etc.) <br />
$bin = 429503; //checking (Bank Identification Number)<br />
$apiUrl = "http://www.binlist.net/{$format}/{$bin}";<br />
$api = new ApiCaller(); //instantiate API Class<br />
$checkBin = $api->call('GET', $apiUrl); //call API call method<br />
var_dump($checkBin); //check output
Here's the sample on how to use the CookieTraits in your controller.
/**
* Class SampleController
*/
class SampleController extends AbstractController
{
use CookieTraits;
/**
* Get the index page
*
* @param Request $request
*/
public function index(Request $request)
{
if (false === $this->isCookieEnabled()) {
// do necessary action if cookie is not enabled
}
// proceed to the next step
}
}
./vendor/bin/phpunit --bootstrap vendor/autoload.php