cyfer65 Posted July 18, 2011 Share Posted July 18, 2011 I need to read some simple text from a url like this http://whatismyip.org/then use that text in a variable like $Text = (Text Read From URL);how can I accomplish this..? Link to comment Share on other sites More sharing options...
Gex Posted July 18, 2011 Share Posted July 18, 2011 Use the GET or REQUEST method. Basically when you pass a variable in the url, for example.www.somesite.com/index.php?name=gexthegeckoYou can use, $_GET['name'] or $_REQUEST['name'] to collect that variable, example:$Text = $_GET['name'];echo $Test;Output: gexthegecko Hope that helps. Link to comment Share on other sites More sharing options...
cyfer65 Posted July 18, 2011 Author Share Posted July 18, 2011 sorry you misunderstood me, I want the IP address text that shows up on the page at that url Link to comment Share on other sites More sharing options...
Gex Posted July 18, 2011 Share Posted July 18, 2011 sorry you misunderstood me, I want the IP address text that shows up on the page at that urlAh my apologies. Do you mean the IP of someone who visits your site, or such. In any case you could just use $_SERVER['REMOTE_ADDR']; Which gets the IP address of the visitor, if thats what you mean? Link to comment Share on other sites More sharing options...
cyfer65 Posted July 18, 2011 Author Share Posted July 18, 2011 no i want to read the text that is displayed on that page, i just referenced that site because all it outputs is just text on the page.. Link to comment Share on other sites More sharing options...
Synook Posted July 18, 2011 Share Posted July 18, 2011 You can use the file_get_contents() function. Link to comment Share on other sites More sharing options...
cyfer65 Posted July 19, 2011 Author Share Posted July 19, 2011 does that file_get_contents() function require curl enabled..? cause my free host has it disabled and that function is not working..but it does work on my paid host though which has curl allowed..is there any other function that woks the same way but doesn't require curl..? Link to comment Share on other sites More sharing options...
Ingolme Posted July 19, 2011 Share Posted July 19, 2011 It requires allowing fopen() wrappers to make remote requests, which is probably disabled on a free web host.In fact, most free web hosts block any remote file handling due to abuse. If cURL is disabled they probably disabled any of the methods that allow you to access remote content. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.