Skip to content

cadot-info/getLinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get All Links of web page or html string

Return a array of url links of page and sub-page:

example: $links=$this->returnAllLinks('https://github.com');

or by html

$links = $this->returnAllLinks($html);

Utilisation

getLinks(start url, int levels, array of $options, array of $links)

-2points => refuse the links before : ,for example with mailto,javascript,.. -point => refuse the links before . ,for example https://github. -class => refuse the links with this classes, example: bigpicture button ... -link => refuse this links for example https:github.com, www.google.com ... -start => refuse link start for example /profiler, http://google -pass => if true, if a link is refused, the code seek in this link for recursivity

use function CadotInfo\getLinks;

class ...
{
   use getLinks;
   ...
   $liens = getLinks('wwwh.goole.fr', 1,);
        foreach ($liens as $url => $texte) {
            dump("Test url:$url(texte)");
   ...
   $this->E('test of links');

tests links

(http://google.fr) (http://thispagedontexiste.exist)