/** * Perform a BIN (Bank Identification Number) or IIN (Issuer Identification Number) lookup. See: https://www.neutrinoapi.com/api/bin-lookup/ * @param string $binNumber Required parameter: The BIN or IIN number (the first 6 digits of a credit card number) * @param string|null $customerIp Optional parameter: Pass in a customers remote IP address. The API will then determine the country of the IP address and match it against the BIN country. This feature is designed for fraud prevention and detection checks. * @return mixed response from the API call*/ public function bINLookup($binNumber, $customerIp = NULL) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/bin-lookup'; //process optional query parameters APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey)); //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json'); //prepare parameters $parameters = array('bin-number' => $binNumber, 'output-case' => 'camel', 'customer-ip' => $customerIp); //prepare API request $request = Unirest::post($queryUrl, $headers, $parameters); //and invoke the API call request to fetch the response $response = Unirest::getResponse($request); //Error handling using HTTP status codes if ($response->code < 200 || $response->code > 206) { //[200,206] = HTTP OK throw new APIException("HTTP Response Not OK", $response->code, $response->body); } return $response->body; }
/** * Send a unique security code to any mobile device via SMS. See: https://www.neutrinoapi.com/api/sms-verify/ * @param string $number Required parameter: The phone number to send a verification code to * @param int|null $codeLength Optional parameter: The number of digits to use in the security code (must be between 4 and 12) * @param string|null $countryCode Optional parameter: ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign) * @param string|null $languageCode Optional parameter: The language to send the verification code in, available languages are: de - German, en - English, es - Spanish, fr - Fench, it - Italian, pt - Portuguese, ru - Russian * @param int|null $securityCode Optional parameter: ass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random code (only numerical security codes are currently supported) * @return mixed response from the API call*/ public function sMSVerify($number, $codeLength = NULL, $countryCode = NULL, $languageCode = NULL, $securityCode = NULL) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/sms-verify'; //process optional query parameters APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey)); //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json'); //prepare parameters $parameters = array('number' => $number, 'output-case' => 'camel', 'code-length' => null != $codeLength ? $codeLength : 5, 'country-code' => $countryCode, 'language-code' => null != $languageCode ? $languageCode : 'en', 'security-code' => $securityCode); //prepare API request $request = Unirest::post($queryUrl, $headers, $parameters); //and invoke the API call request to fetch the response $response = Unirest::getResponse($request); //Error handling using HTTP status codes if ($response->code < 200 || $response->code > 206) { //[200,206] = HTTP OK throw new APIException("HTTP Response Not OK", $response->code, $response->body); } return $response->body; }
/** * Watermark one image with another image. See: https://www.neutrinoapi.com/api/image-watermark/ * @param string $imageUrl Required parameter: The URL to the source image * @param string $watermarkUrl Required parameter: The URL to the watermark image * @param string|null $format Optional parameter: The output image format, can be either png or jpg * @param int|null $height Optional parameter: If set resize the resulting image to this height (preserving aspect ratio) * @param int|null $opacity Optional parameter: The opacity of the watermark (0 to 100) * @param string|null $position Optional parameter: The position of the watermark image, possible values are: center, top-left, top-center, top-right, bottom-left, bottom-center, bottom-right * @param int|null $width Optional parameter: If set resize the resulting image to this width (preserving aspect ratio) * @return binary response from the API call*/ public function imageWatermark($imageUrl, $watermarkUrl, $format = NULL, $height = NULL, $opacity = NULL, $position = NULL, $width = NULL) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/image-watermark'; //process optional query parameters APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey)); //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'APIMATIC 2.0'); //prepare parameters $parameters = array('image-url' => $imageUrl, 'watermark-url' => $watermarkUrl, 'format' => null != $format ? $format : 'png', 'height' => $height, 'opacity' => null != $opacity ? $opacity : 50, 'position' => null != $position ? $position : 'center', 'width' => $width); //prepare API request $request = Unirest::post($queryUrl, $headers, $parameters); //and invoke the API call request to fetch the response $response = Unirest::getResponse($request); //Error handling using HTTP status codes if ($response->code < 200 || $response->code > 206) { //[200,206] = HTTP OK throw new APIException("HTTP Response Not OK", $response->code, $response->body); } return $response->body; }
/** * Extract HTML tag contents or attributes from complex HTML or XHTML content. See: https://www.neutrinoapi.com/api/html-extract-tags/ * @param string $content Required parameter: The HTML content. This can be either a URL to load HTML from or an actual HTML content string * @param string $tag Required parameter: The HTML tag(s) to extract data from. This can just be a simple tag name like 'img' OR a CSS/jQuery style selector * @param string|null $attribute Optional parameter: If set, then extract data from the specified tag attribute. If not set, then data will be extracted from the tags inner content * @param string|null $baseUrl Optional parameter: The base URL to replace into realive links * @return mixed response from the API call*/ public function hTMLExtract($content, $tag, $attribute = NULL, $baseUrl = NULL) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/html-extract-tags'; //process optional query parameters APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey)); //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json'); //prepare parameters $parameters = array('content' => $content, 'output-case' => 'camel', 'tag' => $tag, 'attribute' => $attribute, 'base-url' => $baseUrl); //prepare API request $request = Unirest::post($queryUrl, $headers, $parameters); //and invoke the API call request to fetch the response $response = Unirest::getResponse($request); //Error handling using HTTP status codes if ($response->code < 200 || $response->code > 206) { //[200,206] = HTTP OK throw new APIException("HTTP Response Not OK", $response->code, $response->body); } return $response->body; }