Re: page output to file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aidal wrote:
Hi NG.

I'm having trouble making a local php script open a remote php script and save the output of the remote script in a local file.
I have FTP access to the remote server, so if placing the "local" script at the same server as the "remote" script, makes this easier this would also be an option for me.


What I want to do is like this:

A local script like: http://localhost/fetch_remote_contents.php
fetch_remote_contents.php should open the remote script http://www.blablabla.com/index5.php?id=23554
and save it's output in a local file instead of displaying it in a browser.


If this can't be done, running fetch_remote_contents.php from the same remote server as index5.php and saving the output in a file on the remote server is also an option as I have access to it.

Can anyone help me out here, I'm pretty sure it's possible because I think I've done it before I just forgot how :o(

Thanks, Aidal


you should be able to use functions like fopen or file_get_contents to open the remote file (eg. $contents=file_get_contents('http://www.blablabla.com/index5.php?id=23554'))


but note that this is possible only if your php.ini states that allow_url_fopen=1 else you should be running the script that retrieves the content on the same machine as the script creating the content but to acces the content generated by the http://www.blablabla.com/index5.php?id=23554 script you should have allow_url_fopen set to 1 on the machine where script it is running.
anothr option would be to make the script which generates the content to write that content to a local file which is accesible to the script runing on the same machine through a local path like C:\apache\htdocs\generatedcontent.txt


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux