jwk811 Posted February 18, 2007 Share Posted February 18, 2007 I may be pushing it here but I think it might be possible to do this like paypal does. When a visitor enters my site I want to send there IP address to another website and submit it and retrieve the output which would be their personal information. If there is something close to this that I could do, please help me out here. Thanks! Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 http://us3.php.net/manual/en/ref.curl.php Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 can you help me out with that fert? and is that going to do exactly what i want? i dont understand what to do.. thanks Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 $curl=curl_init("url"); $values=array("ip"=>$_SERVER['REMOTE_ADDR']); curl_setopt($curl,CURLOPT_POST,true); curl_setopt($curl,CURLOPT_POSTFIELDS,$values); $results=curl_exec($curl); Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 will that work with any site or does that site have to have something special? Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 it'll work with any site Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 on the site, does that mean i have to install the curl thing.. this doesnt really make much sense to me but ill try to figure it out but still any more help would be incredible Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 If you don't already have it installed you do need to enable the curl extension Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 If you don't already have it installed you do need to enable the curl extension I think I might because I'm using godaddy's server and they probably have it. $curl=curl_init("url"); $values=array("ip"=>$_SERVER['REMOTE_ADDR']); curl_setopt($curl,CURLOPT_POST,true); curl_setopt($curl,CURLOPT_POSTFIELDS,$values); $results=curl_exec($curl); Is this all I need to know? Okay so the first line I put the url of the page with the form. Next I have an array with the form's input name with the value, correct? And do I need to change anything with the other two lines? Will that get the country, city, etc.? Where will that information go, into an array? Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 Godaddy does have curl enabled by default Okay so the first line I put the url of the page with the form. right Next I have an array with the form's input name with the value, correct? right And do I need to change anything with the other two lines? not really Will that get the country, city, etc.? Where will that information go, into an array? It'll go into the $_POST array Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 Awesome! Thank you so much, your a life saver! Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 For some reason it showed the whole page that had the form on it. Do I need to do something else to get the results? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 nevermind i relized that i was supposed to use the page after the form was submitted lol.. but how can i get the country etc? with the $_POST array? i dont get that Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 anyone? fert? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 bump.. Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 any information you send to page the with this code will go into the $_POST array Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 yeah.. but.. i still dont get it.. okay so $_POST['ip']; will be my ip that i submitted i dont understand how i can get the country etc.. did you see that site http://www.formyip.com/ipcountry.php when you put an ip in the box and submit it the coutry state and city come up on the next page.. are you saying that the country etc is in the $_POST array? can you be a little more informitive please? thanks.. i am very confused Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 To get the country you'll most likely need regex to parse out the data that you need. Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 ok then what did you mean with the "it goes into the $_POST array" Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 ive never heard of regex .. could you help me with that? Quote Link to comment Share on other sites More sharing options...
fert Posted February 18, 2007 Share Posted February 18, 2007 preg_match_all("/<td>(.*?)<\/td>/",$results,$matches); print_r($matches); that should get all the data from the tr tags Quote Link to comment Share on other sites More sharing options...
jwk811 Posted February 18, 2007 Author Share Posted February 18, 2007 i added that to the script and now it just goes to that page and has Array ( [0] => Array ( ) [1] => Array ( ) ) at the bottom.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.