How to transfer echo results to a html page?

Hi Folks,

Currently my scripts echo the results. Now I would like to transfer those results, mainly links, to a html page.
How can this be done?

Kind regards,

Dweep
PeterdeBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Oddsen84Commented:
How do you want to transfer these links? Do you want to add them to an existing page or insert them? Need more info first.
0
PeterdeBAuthor Commented:
Hi Oddsen84,

I would like to add them to an existing page.

Kind regards,

Dweep
0
Oddsen84Commented:
Does this page contain a way to recive these links and is it a static page? If this page doesn't contain a way of reciving links and is a static page then you will need to update the site by writing directly to the sitefiles.

Mabye a better way would be to have the reciving page get it's links from a database and have the sending database send new links to the database.

If any of this isn't clear don't hesitate to ask.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

AnniyanCommented:
$myFile = "yourhtmlfile.html";
$fh = fopen($myFile, 'w');
fwrite($fh, $whateverwasechoed);
fclose($fh);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AnniyanCommented:
replace $whateverwasechoed with (any string/ whatever you passed as parameter to echo)

I think this is what you were looking for
0
Oddsen84Commented:
I don't agree with you Anniyan although you most likely need to use these file functions in php. If you just do it this way you will brake the html format and the page won't be viewable in a browser.

If you want you can find more info here:
http://no.php.net/manual/en/function.fopen.php
http://no.php.net/manual/en/function.fclose.php
http://no.php.net/manual/en/function.fread.php
http://no.php.net/manual/en/function.fwrite.php
http://no.php.net/manual/en/function.file.php
http://no.php.net/manual/en/function.file-exists.php

These are some functions you are bound to meet if you just want to write to file. But I would strongly advise against updating a web page this way
0
Oddsen84Commented:
You could also write all the links to a *.txt file and have the html page contain a bit of php which loops and reads the text out from the file and then displays it.
0
PeterdeBAuthor Commented:
Hi Oddsen84,

I created validated.html containing only the necessary tags to make it a valid html page. How should I change this into a page that is capable of receiving the data?

Furthermore: using a database, will be a complicated matter, right?

Thanks for your responses,

Hi Anniyan,

I am testing your code right now thanks for your responses,

Dweep

0
Oddsen84Commented:
Although setting up a database can be a daunting challenge it's the way to go for a website destined for greatness ;) Making a page able to receive data is not something I can help you with but making a script for saving to file you have already.

<<Anniyan:
<<$myFile = "yourhtmlfile.html";
<<$fh = fopen($myFile, 'w');
<<fwrite($fh, $whateverwasechoed);
<<fclose($fh);

All you need now is to reverse the process so instead of fopen($myFile, 'w'); you use fopen($myFile, 'r');
And instead of the fwrite you use  $text = fread($fh, filesize($myfile));
Then you should use a way of checking if the link(s) exist right? If you always add a \n (newline) then you can use explode("\n", $text); Then just loop trough and check each of your links against the file. If no links already exsist then you just append the new links like Anniyan showed you
0
Oddsen84Commented:
When I say always add a newline character I mean you should append it to the end of all links like this:

$var = 'http://www.someplace.com'."\n";
Notice the difference? I used 'single hyphens' for the link and "double hyphens" for the control character. This is because PHP interprets these differently and instead of just adding the plain text \n it is substituted with the control character for new lines(read all about it here http://en.wikipedia.org/wiki/Control_character)
0
PeterdeBAuthor Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.