mercredi 10 août 2016

Get the friendly url of a page with php

I have the next problem:

I'm trying to get the friendly url of a web page for creating breadcrumps. This web page has a weird way to creat the friendly urls so I cant use my common system

    $dirlist = array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
$count = array_push($dirlist, basename($_SERVER['PHP_SELF']));
$address = 'http://'.$_SERVER['HTTP_HOST'];

then i make a loop

for($i = 1; $i < $count; $i++){
            $url=$address .= '/'.$dirlist[$i]; 

And the code explains itself I guess, i print an UL and stuf...

Well the page that is giving me problems doesnt work with this so i think if I could get just the URL i could work with that

for example the url on the browser looks like "http://ift.tt/2aL3MKm"

So im trying to get with PHP this, but i cant, i cant do it with REQUEST_URI or REQUEST_URL...

Thanks!




Aucun commentaire:

Enregistrer un commentaire