pip install phonenumbers
$ python length_check.py +17075559876
Prints 'True'
$ python length_check.py +170755598764533
Prints 'False'
| // ==UserScript== | |
| // @name Pixieset Client Exporter | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.1 | |
| // @description Export all Pixieset clients to CSV | |
| // @author You | |
| // @match https://studio.pixieset.com/contacts* | |
| // @grant none | |
| // @run-at document-idle | |
| // ==/UserScript== |
| $ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}.json \ | |
| -d "Url=http://example.com/call-agent.php?agent_phone_number=%2b81345678901" \ | |
| -d "Method=GET" \ | |
| -u '{AccountSid}:{AuthToken}' |
| def pure_python_timestamp(year, month, day, hour, minute, seconds): | |
| """ | |
| Sometimes you just need to create a timestamp in Python with no dependencies. | |
| This function creates timestamps without requiring any imports. | |
| Note: This function doesn't fully take into account the century rules for leap years. | |
| >>> pure_python_timestamp('1994','11','19', '22', '01', '22') | |
| 785282482 | |
| >>> pure_python_timestamp('2013','07','03', '08', '14', '15') |
| <?php | |
| use com\google\i18n\phonenumbers\PhoneNumberUtil; | |
| use com\google\i18n\phonenumbers\PhoneNumberFormat; | |
| use com\google\i18n\phonenumbers\NumberParseException; | |
| require_once 'libphonenumber-for-PHP/PhoneNumberUtil.php'; | |
| function sanitize_number ($phone_number, $iso_code) { | |
| $pn = PhoneNumberUtil::getInstance(); | |
| try { |
| import phonenumbers as ph | |
| def japan_format(phone_number, country_code='JP'): | |
| """ | |
| Converts local Japanese formatted number to E.164 format | |
| Arguments: | |
| phone_number -- A Japanese phone number in any format as a string | |
| >>> japan_format("080-1234-5678") |
| """ | |
| Example of a function to determine the country code of a phone number. | |
| Based on the python port of Google's libphonenumber project: | |
| https://github.com/daviddrysdale/python-phonenumbers | |
| """ | |
| import phonenumbers as ph | |
| def get_country_code(phone_number): | |
| """Returns the ISO 3166-1 alpha-2 code for a phone number |
| <?php | |
| /** | |
| * This section ensures that Twilio gets a response. | |
| */ | |
| header('Content-type: text/xml'); | |
| echo '<?xml version="1.0" encoding="UTF-8"?>'; | |
| echo '<Response></Response>'; //Place the desired response (if any) here | |
| /** | |
| * This section actually sends the email. |
The python port of libphonenumber is pretty complete, but is a little short on examples and sample code. Here are some simple examples for some common uses of this fantastic library.
| <?php | |
| header("content-type: text/xml"); | |
| echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; | |
| ?> | |
| <Response> | |
| <Gather action="make-call.php" timeout="30"> | |
| <Say>Please enter the phone number you wish to dial</Say> | |
| </Gather> | |
| </Response> |