Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP Help


ghost's Avatar
0 0

Hello. I would like to open one of my own pages such as http://www.example.com/pagedetect.php to open another page such as http://examples.com/redirect.php (with something similar to curl) that has a header redirect to http://examples2.com/vars.php?rid=389289&id=291.

with my page http://www.example.com/pagedetect.php, I would like to store the get variables of http://examples2.com/vars.php?rid=389289&id=291. Anyone have any ideas how this can be accomplished?

Reply 2 I am sorry I didn't post on this sooner and explain it more clearly. What I really want is for my website to redirect to another website and get its get variables. Then I want to store the get variables on my website. Get it? So if a user clicked a link on my website like http://example.com and got redirected to http://example2.com/vars.php?rid=39003, I want to be able to store the 39003 in my database on my website. http://example2.com and http://example.com would not be my website, thus I don't know how I would be able to store the get variables off of it.

I am making a page that will auto update users of my websites rid. So that way features on my website work properly. Right now I have my users manually going onto the other website, and writing down the rid number. Then coming back onto my website and updating there current rid. You see because the rid expires every 24 hours.

Reply 3 The only thing is, the server that I want the rid from has a white list of ips allowed to connect to it. My server isn't on that white list. So if I used cURL to do the job, My server would be directly loading up the page, thus getting an error.

the website I want the rid from owns http://example.com and http://example2.com. http://example.com will automatically redirect you to example2.com. example2.com will then have the variables that I need in it upon redirect. I may just have to stick with the users manually updating their own rid. I would use javascript but the users are cell phone users. Most of them consisting of boost mobile customers. Boost mobile phones does not support javascript.


ynori7's Avatar
Future Emperor of Earth
0 0

You mean like sticking header('Location:http://examples2.com/vars.php?rid=389289&id=291'); at the top of your http://www.example.com/pagedetect.php page? It's really hard to tell since you explained what you're looking for pretty poorly.


stealth-'s Avatar
Ninja Extreme
0 0

Froger wrote: Hello. I would like to open one of my own pages such as http://www.example.com/pagedetect.php to open another page such as http://examples.com/redirect.php (with something similar to curl) that has a header redirect to http://examples2.com/vars.php?rid=389289&id=291.

with my page http://www.example.com/pagedetect.php, I would like to store the get variables of http://examples2.com/vars.php?rid=389289&id=291. Anyone have any ideas how this can be accomplished?

…wut?


chess_rock's Avatar
Member
0 0

I guess he wants to transfer the GET variables from one php file to another… Right?


ghost's Avatar
0 0

asking for something like this?

$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}```

ghost's Avatar
0 0

Reply 2 I am sorry I didn't post on this sooner and explain it more clearly. What I really want is for my website to redirect to another website and get its get variables. Then I want to store the get variables on my website. Get it? So if a user clicked a link on my website like http://example.com and got redirected to http://example2.com/vars.php?rid=39003, I want to be able to store the 39003 in my database on my website. http://example2.com would not be my website, thus I don't know how I would be able to store the get variables off of it.

I am making a page that will auto update users of my websites rid. So that way features on my website work properly. Right now I have my users manually going onto the other website, and writing down the rid number. Then coming back onto my website and updating there current rid. You see because the rid expires every 24 hours.


goluhaque's Avatar
Member
0 0

Froger wrote: Reply 2 I am sorry I didn't post on this sooner and explain it more clearly. What I really want is for my website to redirect to another website and get its get variables. Then I want to store the get variables on my website. Get it? So if a user clicked a link on my website like http://example.com and got redirected to http://example2.com/vars.php?rid=39003, I want to be able to store the 39003 in my database on my website. http://example2.com would not be my website, thus I don't know how I would be able to store the get variables off of it.

I am making a page that will auto update users of my websites rid. So that way features on my website work properly. Right now I have my users manually going onto the other website, and writing down the rid number. Then coming back onto my website and updating there current rid. You see because the rid expires every 24 hours.

You could use cURL and get(not the form action one) the data, using it to cycle through the page to find the piece of code(here, <input type="blahblahblah" blahblahblah />), and then to insert it in the table.


ghost's Avatar
0 0

The only thing is, the server that I want the rid from has a white list of ips allowed to connect to it. My server isn't on that white list. So if I used cURL to do the job, My server would be directly loading up the page, thus getting an error.

the website I want the rid from owns http://example.com and http://example2.com. http://example.com will automatically redirect you to example2.com. example2.com will then have the variables that I need in it upon redirect. I may just have to stick with the users manually updating their own rid. I would use javascript but the users are cell phone users. Most of them consisting of boost mobile customers. Boost mobile phones does not support javascript.


stealth-'s Avatar
Ninja Extreme
0 0

Unfortunately, I don't think this is possible without Javascript and Iframes, unless of course you had control over example2.com


cyber-guard's Avatar
Not Just a member
0 0

Do you know how the rid is generated? For instance is it just random, or increasing integer with every hit? If the latter you could simple put a onclick ajax even on your link to example.com. The ajax would with the help of cURL access example.com, get redirected to example2.com/?rid=2222, and you would simply return that url, increase it by 1, store the user information and send the user to example.com.

If that is not the case, and you don't have access neither to example.com or example2.com, I don't see a way to do what you want…


ghost's Avatar
0 0

Froger wrote: … open one of my own pages, such as http://www.example.com/pagedetect.php to open another page such as http://examples.com/redirect.php (with something similar to curl) that has a header redirect to http://examples2.com/vars.php?rid=389289&id=291.

… would like to store the get variables of http://examples2.com/vars.php?rid=389289&id=291. Anyone have any ideas how this can be accomplished?

  1. Go here: http://www.php.net/manual/en/function.curl-setopt.php
  2. Read the part about CURLOPT_FOLLOWLOCATION.
  3. Go here: http://www.php.net/manual/en/function.curl-getinfo.php
  4. View examples here: http://curl.haxx.se/libcurl/php/examples/simpleget.html
  5. Use them both appropriately in pagedetect.php.

Post back with any problems after you've tried that, and I'm sure someone will help.


ghost's Avatar
0 0

define wrote: [quote]Froger wrote: … open one of my own pages, such as http://www.example.com/pagedetect.php to open another page such as http://examples.com/redirect.php (with something similar to curl) that has a header redirect to http://examples2.com/vars.php?rid=389289&id=291.

… would like to store the get variables of http://examples2.com/vars.php?rid=389289&id=291. Anyone have any ideas how this can be accomplished?

  1. Go here: http://www.php.net/manual/en/function.curl-setopt.php
  2. Read the part about CURLOPT_FOLLOWLOCATION.
  3. Go here: http://www.php.net/manual/en/function.curl-getinfo.php
  4. View examples here: http://curl.haxx.se/libcurl/php/examples/simpleget.html
  5. Use them both appropriately in pagedetect.php.

Post back with any problems after you've tried that, and I'm sure someone will help.[/quote]

phpCURL would work if my server wasn't the one loading the page. If it was the users that were loading the page then yea, I could work something that would work. Sadly though, since the website has a white list, the only message the users would get is a forbidden message.


ghost's Avatar
0 0

No what? Thanks define. Because of you I did go back and look again at some possibly useful curl functions. The function curl_getinfo is very useful. With it, I can get what the url is of the page. So if I used the curl function followlocation, I can use curl_getinfo to see what the last current url is. Which happens to have the variables I need in the url. Thanks, now its possible to go ahead and make a page the users can use to update there rid.