Jump to content

Read an external source


notclive

Recommended Posts

The only thing you can save is the HTML output produced by PHP, unless you have direct access to the server (FTP, SSH, telnet etc) you can't get to the PHP source. If you do have FTP access, you can use PHP to login through FTP and get the source that way.

Link to comment
Share on other sites

Including will do that though you can't store the output in a variable.EDIT: I take that back, look at this example:

$string = get_include_contents('somefile.php');function get_include_contents($filename) {   if (is_file($filename)) {       ob_start();       include $filename;       $contents = ob_get_contents();       ob_end_clean();       return $contents;   }   return false;}

Link to comment
Share on other sites

highlight_file()?I beleive there was another topic on this.. anyways just do this:

highlight_file('url_here');

and it will automatically "echo" the source code out.

Link to comment
Share on other sites

Ive tried lots of methods and keep getting a similar error message heres my current php file

<?phphighlight_file('http://www.aokforums.com/notclive/index.php');?>

and heres the error message

Warning: highlight_file(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/www/forum.notclive.co.uk/bar.php on line 2Warning: highlight_file(http://www.aokforums.com/notclive/index.php): failed to open stream: Address family not supported by protocol in /home/www/forum.notclive.co.uk/bar.php on line 2Warning: highlight_file(): Failed opening 'http://www.aokforums.com/notclive/index.php' for highlighting in /home/www/forum.notclive.co.uk/bar.php on line 2

Link to comment
Share on other sites

Asylum is right, but if that happens you can still do it for pages on the same server, so in your case any page on the server with you can be acessed, but not on outside servers.

Link to comment
Share on other sites

I don't think one host can disable outside PHP from accessing files by a request. A request is a request, no matter where it comes from.You don't want to use highlight_file though, that is only for local PHP scripts. It highlights the PHP source, which you can't get over HTTP. Use the function I pointed you to if you want to get the HTML output in a string through HTTP.

Link to comment
Share on other sites

still nothing

<?phpini_set('allow_url_fopen',true);$page=file_get_contents("http://www.aokforums.com/notclive/index.php");echo $page;?>

anybody understand what this error message means

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/www/forum.notclive.co.uk/bar.php on line 3Warning: file_get_contents(http://www.aokforums.com/notclive/index.php): failed to open stream: Address family not supported by protocol in /home/www/forum.notclive.co.uk/bar.php on line 3

Link to comment
Share on other sites

still nothing

<?phpini_set('allow_url_fopen',true);$page=file_get_contents("http://www.aokforums.com/notclive/index.php");echo $page;?>

anybody understand what this error message means

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/www/forum.notclive.co.uk/bar.php on line 3Warning: file_get_contents(http://www.aokforums.com/notclive/index.php): failed to open stream: Address family not supported by protocol in /home/www/forum.notclive.co.uk/bar.php on line 3

Link to comment
Share on other sites

No address associated with hostname
It does seem like a DNS issue. If possible, try restarting the bind service on the server (or ask an admin to do it). Also, give the error message to an admin, he might know what to do.You can also try accessing via IP instead of hostname. The IP address of aokforums.com is 72.36.168.178, you can try accessing that instead, but I'm getting a 404 for this:http://72.36.168.178/notclive/index.phpEven though the hostname works. They might be redirecting your site to another IP, or they might be disallowing access by IP.I just had a thought. Something about the no address associated with hostname error plus unable to access via IP - there might be some restriction on the other server that is stopping you from being able to do this. Try to open http://www.google.com from the same location and see if that works.
Link to comment
Share on other sites

Some people are surprised at how easy it is to find a lot of information out that they thought was private. So I'll introduce you to this site:http://www.dnsstuff.com/Play with that page for a while, give it a look. If you want to find out IP, you can either use DNS lookup (top right box), type in the domain name, and select ANY (ALL) for the record type. That will give you the names of mail servers, DNS servers, any subdomains defined in DNS for that hostname. You can also type the hostname into Ping or Traceroute and get the IP. Also, check out the City from IP box. Find out where those bastards hitting your server live.. Apparently the aokforums.com server is located in Dallas, Texas.

Link to comment
Share on other sites

Try using the CURL functions instead:http://www.php.net/curl

<?php// create a new curl resource$ch = curl_init();// set URL and other appropriate optionscurl_setopt($ch, CURLOPT_URL, "http://www.example.com/");curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);// grab URL and store it in a string$page_text = curl_exec($ch);// close curl resource, and free up system resourcescurl_close($ch);?>

Link to comment
Share on other sites

It works for me:http://manchine.net/w3/curl.php

<?php// create a new curl resource$ch = curl_init();// set URL and other appropriate optionscurl_setopt($ch, CURLOPT_URL, "http://www.aokforums.com/notclive/index.php");curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);// grab URL and store it in a string$page_text = curl_exec($ch);// close curl resource, and free up system resourcescurl_close($ch);?><html>  <head>    <title>CURL</title>  </head>  <body>    <textarea rows="20" cols="80"><?php echo $page_text; ?></textarea>  </body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...