I've a script that is executed from a remote include, but this script needs a variable that must be the URL from where it's called. For example: the script is in http://www.mydomainn.com/script.php, it's called through an include in any http://www.otherdomain.com/index.php and the script needs that data (the URL http://www.otrodominio.com/index.php or http://www.otrodominio.com/ ). How I can do it? … Thanks.
that makes like no sense. i mean, if you're addressing the script on host2 then obviously you know where it is.
no matter where your file is. it will work always where it is included. so, if you need variable from mysql, you'll need to authorize your otherdomain.com to connect mysql on mydomainn.com. if it is not, include all your files via url.
Why don't you use GET? call www.myscript.com/script.php?val=www.callinghost.com in script, you can access $_GET['val'] and it will contain www.callinghost.com Or have I misunderstood.
Somebody, from any random page can call to my script with an include. My script must know the URL from it has been called.
Put the following code in a file: <pre> <?php print_r($_SERVER); ?> </pre> PHP: Do you see [HTTP_REFERER]?
I stand by my original post as I believe it solves this! include: www.host.com/script.php?val=[calling host URL] The script can get the calling host name using $_GET['val']
I retake the subject because not yet I have found the solution. In the network, there are many services that placing a code in our page show an PageRank button indicator. Well, these services work placing only a code similar to this: <img src="http://www.domain-of-the-script.com/pr.php"> Code (markup): It's clear that script takes, of some way, our URL to give back the PR indicator pertaining to the page where we have placed the code. Well, that I would like to know, how script is able to take our URL?. (Excuse me by my English language)
Yes, my idea solves this! Try this: <img src="http://www.domain-of-the-script.com/pr.php?url=www.callingurl.com"> Code (markup): (replace www.callingurl.com with the URL of the server calling the script.) And access $_GET['url'] within the script. It contains the calling URL!
That solution already knew it. I would like to know the other: <img src="http://www.domain-of-the-script.com/pr.php"> Code (markup): Thanks.