Menší zlepšení pro pc-help - tvorba webu
Moderátoři: Ltb, Mods_senior
- CZechBoY
- Master Level 9.5

- Příspěvky: 8813
- Registrován: 20 srp 2008 14:02
- Bydliště: Brno
- Kontaktovat uživatele:
Re: Menší zlepšení pro pc-help - tvorba webu
Pokud zjistíš jak se to instí dodal bych ukázku, ale tohle se nedá 
Tak jsem přišel na to jak se to instí, ale to jejich FIND a REPLACE with mě trošku štve, je tam toho snad 50řádků.
Tak jsem přišel na to jak se to instí, ale to jejich FIND a REPLACE with mě trošku štve, je tam toho snad 50řádků.
PHP, Nette, MySQL, C#, TypeScript, Python
IntelliJ Idea, Docker, Opera browser, Linux Mint
iPhone XS
Raspberry PI 3 (KODI, Raspbian)
XBox One S, PS 4, nVidia GeForce NOW
IntelliJ Idea, Docker, Opera browser, Linux Mint
iPhone XS
Raspberry PI 3 (KODI, Raspbian)
XBox One S, PS 4, nVidia GeForce NOW
- Ltb
- Administrátor
- Příspěvky: 6796
- Registrován: 28 úno 2003 23:53
- Bydliště: Praha západ
- Kontaktovat uživatele:
Re: Menší zlepšení pro pc-help - tvorba webu
Hotovo, díky za nápad. Více info o Syntax Highligher uvádím zde. Použití není nejsnazší, ale pevně věřím, že nakonec highlighter může někomu posloužit.
[syntax filename=priklad.php lang=php]<?php
$var = fread_url($url);
preg_match_all ("/a[\s]+[^>]*?href[\s]?=[\s\"\']+".
"(.*?)[\"\']+.*?>"."([^<]+|.*?)?<\/a>/",
$var, &$matches);
$matches = $matches[1];
$list = array();
foreach($matches as $var)
{
print($var."<br>");
}
// The fread_url function allows you to get a complete
// page. If CURL is not installed replace the contents with
// a fopen / fget loop
function fread_url($url,$ref="")
{
if(function_exists("curl_init")){
$ch = curl_init();
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; ".
"Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt( $ch, CURLOPT_HTTPGET, 1 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_REFERER, $ref );
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
$html = curl_exec($ch);
curl_close($ch);
}
else{
$hfile = fopen($url,"r");
if($hfile){
while(!feof($hfile)){
$html.=fgets($hfile,1024);
}
}
}
return $html;
}
?>[/syntax]
[syntax filename=priklad.php lang=php]<?php
$var = fread_url($url);
preg_match_all ("/a[\s]+[^>]*?href[\s]?=[\s\"\']+".
"(.*?)[\"\']+.*?>"."([^<]+|.*?)?<\/a>/",
$var, &$matches);
$matches = $matches[1];
$list = array();
foreach($matches as $var)
{
print($var."<br>");
}
// The fread_url function allows you to get a complete
// page. If CURL is not installed replace the contents with
// a fopen / fget loop
function fread_url($url,$ref="")
{
if(function_exists("curl_init")){
$ch = curl_init();
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; ".
"Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt( $ch, CURLOPT_HTTPGET, 1 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_REFERER, $ref );
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
$html = curl_exec($ch);
curl_close($ch);
}
else{
$hfile = fopen($url,"r");
if($hfile){
while(!feof($hfile)){
$html.=fgets($hfile,1024);
}
}
}
return $html;
}
?>[/syntax]
-
- Podobná témata
- Odpovědi
- Zobrazení
- Poslední příspěvek

