Hi I'm trying to get the referrer url but it doesn't work when the visitor comes to the site from Paypal
$ref = $_SERVER['HTTP_REFERER'];
echo $ref;
Is there a simple way to get the paypal url if the visitor land on the site coming from Paypal ?
Edit and Clarification: I'm not looking to have any special settings on the Paypal site (including but not limited to: IPN, set the return URL, Payment Data Transfer or any other special settings on the Paypal site) All that I'm looking is to get the URL referer when visitors come to the site from Paypal, regardles of the status of a transaction (if there was one).
As pointed by Bob from the manual
$_SERVER is an array containing information such as headers, paths, and script locations. The >entries in this array are created by the web server. There is no guarantee that every web >server will provide any of these; servers may omit some, or provide others not listed here.
So the only question left is - Is there any workaround to this without set something on the paypal site ?
In case your site uses HTTP (not HTTPS) and PayPal uses HTTPS, there is no Referrer being sent!
HTTP RFC - 15.1.3 Encoding Sensitive Information in URI's states:
Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol.
So the only way to get the Referrer is to use HTTPS on your site.