-1

I want to hit a URL - http://www.blahblah.com/on/demand

After each hit the aforementioned URL will generate an extension.

I.e. http://www.blahblah.com/on/demand/C1212

So, that I want to do is to take the generated extension (C1212) I have no idea how can I do this? Does anyone know how can I do this with PHP?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Nick Robertson
  • 1,047
  • 4
  • 18
  • 41
  • 1
    How does it generate the extension? i.e. Where is it found? – Wayne Whitty Nov 08 '12 at 09:16
  • cron ?? it is something which u can check – swapnesh Nov 08 '12 at 09:16
  • http://www.blahblah.com/on/demand redirects to http://www.blahblah.com/on/demand/C1212 ? – theredled Nov 08 '12 at 09:21
  • No, it doesn't redirect. You can see this only if you press INSPECT ELEMENT. And generally is using an IBM mechanism to make this generation – Nick Robertson Nov 08 '12 at 09:26
  • @NickRobertson Could you give an example for a site that does this so we could check whether you can read it in the headers of the site? (hence be able to use cURL to find out). – h2ooooooo Nov 08 '12 at 09:32
  • @NickRobertson — Is your question "How do I use PHP to get the URL from the href attribute of a link in an HTML document at a particular URL?" – Quentin Nov 08 '12 at 09:44
  • possible duplicate of [How to parse and process HTML with PHP?](http://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php) – Quentin Nov 08 '12 at 09:46

1 Answers1

3

Hope this answers you. Try this out.

<?php
    $url = $_SERVER['REQUEST_URI'];
    $extension = end(explode('/',$url));
    echo $extension;        
?>
René Höhle
  • 26,716
  • 22
  • 73
  • 82
bikash shrestha
  • 429
  • 2
  • 5