Labels

php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Wednesday, January 24, 2018

How to Parse/Divide URL in PHP?

parse_url is a simple tool/predefined function to parse/divide URL into individual components.

components are:

1. scheme
2. host
3. path
4. query


example:


<?php

//URL
$url = "http://www.phpjavascript.com/post.php?par1=one&par2=two";

$url = parse_url($url);

//print_r($url);

echo 'scheme = '.$url['scheme'];
echo 'host = '.$url['host'];
echo 'path = '.$url['path'];
echo 'query = '.$url['query'];

?>

Result:

scheme = http
host = www.phpjavascript.com
path = /post.php
query = par1=one&par2=two

9 comments:

  1. Hi, Neat post. There is a problem with your website in internet explorer, would check this… IE still is the market leader and a big portion of people will miss your wonderful writing due to this problem. a math tuition singapore

    ReplyDelete
  2. Hello, you used to write fantastic, but the last several posts have been kinda boring… I miss your super writings. Past few posts are just a little bit out of track! come on!Honestbee grocery delivery service

    ReplyDelete
  3. Thanks very nice share this concept is a good way to enhance the knowledge. Digital Signature Certificate.

    ReplyDelete
  4. I think this is one of the most significant info for me. And i am glad reading your article. But want to remark on some general things, The website style is perfect, the articles is really great : D. Good job, corporate website redesign

    ReplyDelete
  5. Thanks for sharing the relevant information with us…It are good for us. Apply Class 3 Digital Signature Certificate

    ReplyDelete
  6. A person essentially help to make seriously posts I would state. This is the very first time I frequented your website page and thus far? I surprised with the research you made to create this particular publish amazing. Wonderful job!website seo analysis tool online

    ReplyDelete
  7. Heya just wanted to give you a quick heads up and let you know a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue. I've tried it in two different web browsers and both show the same outcome. Automate Segmentation and Targeting

    ReplyDelete

More Posts

FOLLOW