yeahz Posted February 25, 2010 Report Share Posted February 25, 2010 (edited) kā lai no adreses iegūst adresi (tā dīvaini skan :D)? http://www.tvnet.lv/auto/par_un_ap/305424-ka_efektigi_iznicinat_auto => http://www.tvnet.lv/ Edited February 25, 2010 by yeahz Quote Link to comment Share on other sites More sharing options...
Bunkertor 7 Posted February 25, 2010 Report Share Posted February 25, 2010 (edited) Vislabāk ar pregmatch, bet šitais piemērs darbosies tikai ar tiem domēniem, kuriem ir vienkāršs extension, tā kā .com un .lv Ja būs .co.uk vai .go.jp, tad nekā :P pārtaisi biški, man slinkums! <?php preg_match("/^(http:\/\/)?([^\/]+)/i", "http://www.tvnet.lv/auto/par_un_ap/305424-ka_efektigi_iznicinat_auto", $skaldi); $domeens = $skaldi[2]; preg_match("/[^\.\/]+\.[^\.\/]+$/", $domeens, $skaldi); echo "url ir: {$skaldi[0]}\n"; ?> Edited February 25, 2010 by Bunkertor 7 Quote Link to comment Share on other sites More sharing options...
daGrevis Posted February 25, 2010 Report Share Posted February 25, 2010 Es domāju, ka Tu par urlām runā... :D Te ir manis (kādreiz, paldies) pieprasītais skripts, JS. Ka slīdzīgs tur notiek. :) http://paste.php.lv/9d0f0d217af237db8ab4a5f3e36d2bfb?lang=javascript Quote Link to comment Share on other sites More sharing options...
marcis Posted February 25, 2010 Report Share Posted February 25, 2010 Pēc tā, kā autors pasniedza "problēmu", domāju, ka pilnīgi pietiek ar parse_url() Quote Link to comment Share on other sites More sharing options...
yeahz Posted February 25, 2010 Author Report Share Posted February 25, 2010 (edited) paldies function urlis($url) { return parse_url($url, PHP_URL_SCHEME) . "://" . parse_url($url, PHP_URL_HOST); } Edited February 25, 2010 by yeahz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.