/    Sign up×
Community /Pin to ProfileBookmark

fopen and server ip address

I need a way to use fopn or fread to open a site and read the contents without the site knowing that its my server sending the request

so when someone visits my site and opens the page with the code on it their ip address will be used somehow so that the site im trying to open with fopen or fread will think they are viewing it and not my host server

i need it to do this because of the fact the page on the site i am opening using the above methods checks the ip address and displays some info based on that and if its only going to display info based on my servers ip address it is no good

I need it to show info based on the visitors ip address

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@TaschenApr 09.2007 — What you are asking for is a way to use the content/services of a third party site as though they were your own. Do you really think that is right?

If a third party site wants you to use their content they will provide a mechanism (such as an API or XML feed) to access their content.
Copy linkTweet thisAlerts:
@BWWebDesignsauthorApr 09.2007 — but i need a way to access that service correctly but using php and not javascript so i can combine it with the php script i have

the code they suggest to use is

[CODE]<script language="Javascript" src="http://www.ip2phrase.com/ip2phrase.asp?template=City name is <CITY> State is <REGION> Country is <COUNTRY>."></script>[/CODE]

If i could somehow use this javascript to take the info for city state and country and place that into a cookie in the format of city, state, country

Then i would be able to call that cookie in my php script on a refresh of the page

But how would i convert the javascript above to make it be able to set the info pulled from their site into a cookie
Copy linkTweet thisAlerts:
@TaschenApr 09.2007 — There is no way of accurately capturing the remote address (ip) of a client using your web site. Indeed it is straight forward enough to spoof an IP address. You can attempt to get a users IP using $_SERVER['REMOTE_ADDR'] more here

http://uk2.php.net/function.getenv
Copy linkTweet thisAlerts:
@BWWebDesignsauthorApr 09.2007 — well im not looking to capture accurately their ip

Im looking to use a service to convert their ip into city state and country and then convert that into lat and long coords and use those in a google maping script to display a marker

Now i know the locationw ill not be accurate and if someone has spoofed their ip address etc but alot of the time when people havent it will be at least in roughly the right area

i see alot of other sites doing this in some form or another
Copy linkTweet thisAlerts:
@BWWebDesignsauthorApr 09.2007 — i was using

[CODE]$filename = "http://www.ip2phrase.com/ip2phrase.asp?template=%2F<IP>%2F<COUNTRY>%2F<COUNTRYSHORT>%2F<REGION>%2F<CITY>%2F<ISP>%2F&ip=$ipaddress";
$handle = fopen($filename, "r");
$address = fread($handle, 500);
fclose($handle);
echo $address."<BR>";[/CODE]


This used fopen to visit their site and pull the info generated into my php variables only problem is when you do that their site gets the ip address of your web hosting server and not the person visiting the page

is there a way aroudn this??
×

Success!

Help @BWWebDesigns spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...