PDA

View Full Version : Get contentid in php


zero477
11-07-2012, 10:39 PM
Hello to all,

I need the contentid of articles to create a widget ... currently i am using:

$thecontentid=$_GET["r"];

But I get the whole url string, for exaple of this URL:

http://www.example.com/content/487-caca-de-perro

I get = 487-caca-de-perro

And I just want to get

487

Do anyone knows how to do this?

kh99
11-07-2012, 10:52 PM
You could try this:

$thecontentid=intval($_GET["r"]);