Hi , i want to ask about php coding.
Basically i enter a url like example http://my-domain.com/goto1.php?s=111a and it redirect me to http://my-domain.com/111.html
how do i grab this http://my-domain.com/111.html which is the response url and assign this value to a variable
I need to store the response url as a variable and use it , thanks in advance!
How do i Grab the response url?
Moderator: General Moderators
Re: How do i Grab the response url?
baoky wrote:Hi , i want to ask about php coding.
Basically i enter a url like example http://my-domain.com/goto1.php?s=111a and it redirect me to http://my-domain.com/111.html
how do i grab this http://my-domain.com/111.html which is the response url and assign this value to a variable
I need to store the response url as a variable and use it , thanks in advance!
I'm no quite sure I understand what you're doing.
You have a link on your site: <a href="http://my-domain.com/goto1.php?s=111a">link</a>
And you want to (without clicking it...so programmically/dynamically) get the url it would redirect you to: http://my-domain.com/111.html
?
Are you setting this variable from http://my-domain.com/goto1.php?s=111a? or when you get to http://my-domain.com/111.html?
If you load the page http://my-domain.com/111.html, in an iFrame on http://my-domain.com/goto1.php?s=111a, you can, with JavaScript, get that iFrames URL and set it as a cookie to later be read via PHP.
Code: Select all
echo $_SERVER['SERVER_NAME']; // may help...on this site, this func would return something like: forums.devnetwork.net/posting.php?mode=quote&f=1&p=481042 (getting http or https is another function).
Re: How do i Grab the response url?
If I have correctly understood look at mod_rewrite
For example create .htaccess file in root directory (folder this index.php)
For example create .htaccess file in root directory (folder this index.php)
Code: Select all
RewriteEngine on
RewriteRule ^([0-9]+).html$ http://my-domain.com/goto1.php?s=$1