1. Go to this page and download the library: Download antheta/falcon library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
antheta / falcon example snippets
$falcon = Falcon::getInstance()->run("https://example.com/");
$result = $falcon->parse()->results(); // use all available parsers and get all results
// this will attempt to parse emails with the given regex
$falcon = Falcon::getInstance()
->addRegexes("email", ["/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-ddd]+/i"])
->run("https://example.com/")->parse()->emails();
// you can extend this to other parsers as well and add as many regexes as needed
$falcon = Falcon::getInstance()
// regexes for emails
->addRegexes("email", [
"/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-ddd]+/i",
"/[\._a-zA-Z0-9-]+\(at\)[\._a-zA-Z0-9-]+/i",
])
// regexes for phonenumbers
->addRegexes("phonenumber", [
"/([\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,12})/",
])
->run("https://example.com/")
->parse()
->results();
$falcon = Falcon::getInstance();
$falcon->addParser("myCustomParser", fn ($payload) => MyParser($payload));
function MyParser($payload) {
// your custom logic here
}
// or
$falcon->addParser("myCustomParser", function($payload) {
// your custom logic here
});
// result from your parser
$falcon->parse("myCustomParser")->results()["myCustomParser"];