Jump to content

Recommended Posts

How do I break down a string?

 

I have a External Link Checker(http://links.krazypicks.com), which will check to see if the URL is in the blacklist that is in the database, but if it is not then it will show a continue warning. Well I want to know how to break down the URL. say they type this in:

 

 

I want to break it down to www.youtube.com, to check, then display the real URL.

 

Does this make sense?  You can just give me a function.

 

-Thanks :D

 

Link to comment
https://forums.phpfreaks.com/topic/127642-solved-breaking-down-a-string/
Share on other sites

ok so I have this bit:

 

<?php
$link = print_r(parse_url($url));
?>

 

but it is echoing out, and I know it is in an array, but how to I take it out?

 

here is an example of the out put:

 

Array ( [scheme] => http [host] => www.youtube.com [path] => /watch [query] => v=Cqsrq34qDyk )

 

how can I just echo out the host?

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.