PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
my question is: how, using php, download source code of an external webpage? i have an url http://www.example.com/index.php?show=0123 and if I pass it to the file() function, it kicks back an error. I belive that it is because i use arguments in url (that are nececitary). is there something similat to linux
To do that in PHP the URL wrapper option in PHP.ini has to be enabled .. if it is then file(), file_get_contents(), etc will all work. If it's not then you could alternatively use shell() or exec() with wget.
It's obvious, but in case you're not aware it will download the HTML source, not the PHP/Perl/ASP/whatever. You can't get that.
well, it is not my server and i am afraid that i cannot play with php.ini configuration... and what if i cannot exec anything as well? is there any php procedure that would work here?
bucz wrote:well, it is not my server and i am afraid that i cannot play with php.ini configuration... and what if i cannot exec anything as well? is there any php procedure that would work here?
You could try curl(), or fsockopen(), but they're both going to be a lot more complicated than things like file_get_contents(), and they probably won't work if the server is locked down properly.