Click to See Complete Forum and Search --> : get referring site info
bsmbahamas
04-04-2008, 06:39 AM
hi guys is there a way to use php to determine the full url of the previous site someone came from as well as the title of that page?
i'm creating a bookmarking script and want users to click a bookmark
image and have it autofill with the title and url of the page they came from,
so they can just edit if need be and submit.
thanks.
stephan.gerlach
04-04-2008, 06:54 AM
Sure
to get the referer you can use $_SERVER['HTTP_REFERER'];
In order to get the title of that page is a little bit more tricky. You need to get the referring page like with file_contents and then extract the text between the <title></title> tags.
bsmbahamas
04-04-2008, 08:06 AM
thanks stephan.gerlach i was thinking that would be the code to use,
and i'll probably go with a hidden form that would grab the title of the referring page.
by the way do you know how to create an array of all the files in a directory on *my* server, or just a particular type like images, for a photo gallery script that will read the directory and create a thumbnailed gallery page.
i just need to get the names of all the images into an array, not the full path to the image, but i can chop of extra info with the explode function if need be, thanks.
LiLcRaZyFuZzY
04-05-2008, 07:00 PM
@bsmbahamas
you can use the glob() function, to list the content:
http://php.net/glob or scandir: http://php.net/scandir