/    Sign up×
Community /Pin to ProfileBookmark

get referring site info

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.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@stephan_gerlachApr 04.2008 — 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.
Copy linkTweet thisAlerts:
@bsmbahamasauthorApr 04.2008 — 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.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYApr 06.2008 — @bsmbahamas

you can use the glob() function, to list the content:

http://php.net/glob or scandir: http://php.net/scandir
×

Success!

Help @bsmbahamas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...