DOMDOCUMENT.SAVEHTMLFILE(3) 1 DOMDOCUMENT.SAVEHTMLFILE(3)DOMDocument::saveHTMLFile - Dumps the internal document into a file using HTML formatting
SYNOPSIS
public int DOMDocument::saveHTMLFile (string $filename)
DESCRIPTION
Creates an HTML document from the DOM representation. This function is usually called after building a new dom document from scratch as in
the example below.
PARAMETERS
o $filename
- The path to the saved HTML document.
RETURN VALUES
Returns the number of bytes written or FALSE if an error occurred.
EXAMPLES
Example #1
Saving a HTML tree into a file
<?php
$doc = new DOMDocument('1.0');
// we want a nice output
$doc->formatOutput = true;
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
$head = $doc->createElement('head');
$head = $root->appendChild($head);
$title = $doc->createElement('title');
$title = $head->appendChild($title);
$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
echo 'Wrote: ' . $doc->saveHTMLFile("/tmp/test.html") . ' bytes'; // Wrote: 129 bytes
?>
SEE ALSO
DOMDocument::saveHTML, DOMDocument::loadHTML, DOMDocument::loadHTMLFile.
PHP Documentation Group DOMDOCUMENT.SAVEHTMLFILE(3)
Check Out this Related Man Page
DOMDOCUMENT.LOADHTML(3) 1 DOMDOCUMENT.LOADHTML(3)DOMDocument::loadHTML - Load HTML from a string
SYNOPSIS
public bool DOMDocument::loadHTML (string $source, [int $options])
DESCRIPTION
The function parses the HTML contained in the string $source. Unlike loading XML, HTML does not have to be well-formed to load. This func-
tion may also be called statically to load and create a DOMDocument object. The static invocation may be used when no DOMDocument proper-
ties need to be set prior to loading.
PARAMETERS
o $source
- The HTML string.
o $options
- Since PHP 5.4.0 and Libxml 2.6.0, you may also use the $options parameter to specify additional Libxml parameters.
RETURN VALUES
Returns TRUE on success or FALSE on failure. If called statically, returns a DOMDocument or FALSE on failure.
ERRORS /EXCEPTIONS
If an empty string is passed as the $source, a warning will be generated. This warning is not generated by libxml and cannot be handled
using libxml's error handling functions.
This method may be called statically, but will issue an E_STRICT error.
While malformed HTML should load successfully, this function may generate E_WARNING errors when it encounters bad markup. libxml's error
handling functions may be used to handle these errors.
EXAMPLES
Example #1
Creating a Document
<?php
$doc = new DOMDocument();
$doc->loadHTML("<html><body>Test<br></body></html>");
echo $doc->saveHTML();
?>
CHANGELOG
+--------+----------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+----------------------------+
| 5.4.0 | |
| | |
| | Added $options parameter. |
| | |
+--------+----------------------------+
SEE ALSO
DOMDocument::loadHTMLFile, DOMDocument::saveHTML, DOMDocument::saveHTMLFile.
PHP Documentation Group DOMDOCUMENT.LOADHTML(3)
Hi All,
How can the head command be used to extract only a particular line.
By default head -n filename displays the first n lines. I want only the nth line.
I couldn't get it from forum search.
Thanks,
Sumesh (6 Replies)
hi i ama dunmmies in Unix.
I created a .doc file and copied it to unix via FTP as a ,doc file itself
i want to delete that file , i tried with rm command it does not work
file name is DDL's.doc
plz help :confused: (2 Replies)
Hi guys,
I am in need of a simple, (typically one-liner) script to get the last 17 bytes of a line.
Eg.
echo "abcdefghijklmnopqrstuv"
here i would need the last 17 bytes of the text
ie. fghijklmnopqrstuv
The text length is dymanic (but always more than 17)...it can even span upto... (2 Replies)
On OS 10.4.11
I have filenames like:
670711 SA T2 v1-1_DS_EF.doc
CT_670520 AM T1 v1-2_DS_EF.doc
CT_670716 - 2 SA T4 v1-2_DS_EF.doc
CT_670713 SA T3 v1-1_DS_EF.doc
670421 PA DYP1 v1-1_DS_EF.doc
CT_670425 PA DYP2 v1-1_DS_EF.doc
CT_670107 RA T3 v1-2_DS_EF.doc
CT_670521 AM T2 v1-2_DS_EF.doc... (3 Replies)
Hello how are you, i have a question i have a file ale.log and i want to agregate a title and later a space when the text is over and put another title (when the text is over) how can i do this? thank you
Example
Last ------>(Title) i want to agregate
pupu pupu pupu pupu... (1 Reply)
Dear all.
I need to extract the title (text between <title> and </title>) of a set of HTML documents.
I've found a command that makes the work of extracting the text, but it does not always work.
It works with the next example:
cat a.txt
htmltext<title>This is a HTML... (2 Replies)
I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying:
c=$(head -1 somefile)
echo $c
which outputs correctly, but them when I do
...
somecommand $c
it says it can't find the file, is that because it's grabbing the whole line, and... (5 Replies)
I know that the common use of head is for example head -3 etc.Is there any possibility that,if i have a variable that equals to an integer(i=5),i can write head -i??
If not,what syntax or commands should i write down in order to have the same result?
//maybe something lik head -"$variable" ? (2 Replies)
Hi all,
I was wondering why tail -n 2 filename produce an error when I manage to do similar command on head -n 2 filename
SunOS{type8code0}: tail -n 2 filename
usage: tail ]
tail ] (2 Replies)
Hi,
Based on the following example in the Boost C++ website:
www. boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp]doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp
I tried to create a similar TCP server that waits to accept a client connection... (0 Replies)
Hi,
This is my first post here and I am a newbie. :)
I have a file that looks like this :
Introduction:Intro_123.html
Product definition:Prod_def.html
System Setup:SSetup-64bit.html
Setting up user accounts:Set_user_acc.html
I tried to create a script that would output "The filename... (3 Replies)
Hi all,
I have a list of text, single column and I want to print the first 20, then the second 20 and so on. I was pointed to xarg to help with this, but can't get my head around how to use it.
Would be great if it would put them into separate files with a certain name.
Any suggestions... (2 Replies)