Jump to content
php.lv forumi

Iegūt urli


yeahz

Recommended Posts

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 by Bunkertor 7
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...