30
votes
7answers
9k views

Grabbing the href attribute of an A element

Trying to find the links on a page. my regex is: /<a\s[^>]*href=(\"\'??)([^\"\' >]*?)[^>]*>(.*)<\/a>/ but seems to fail at <a title="this" href="that">what?</a> ...
141
votes
0answers
46k views

Robust and Mature HTML Parser for PHP [duplicate]

Are there any robust and mature HTML parsers available for PHP? A quick skimming of PEAR didn't turn anything up (lots of classes for generating HTML, not so much for consuming), and Google taught me ...
320
votes
26answers
181k views

Convert HTML + CSS to PDF with PHP?

Ok, I'm now banging my head against a brick wall with this one. I have an HTML (not XHTML) document that renders fine in Firefox 3 and IE 7. It uses fairly basic CSS to style it and renders fine in ...
57
votes
0answers
8k views

How to parse HTML with PHP? [duplicate]

Possible Duplicate: How to parse and process HTML with PHP? Suggestion for a reference question. Stack Overflow has dozens of "How to parse HTML" questions coming in every day. However, ...
65
votes
17answers
117k views

How to extract img src, title and alt from html using php?

I would like to create a page where all images which reside on my website are listed with title and alternative representation. I already wrote me a little program to find and load all HTML files, ...
1
vote
5answers
2k views

Cannot modify header information - headers already sent, Why its happening [duplicate]

Possible Duplicate: Headers already sent by PHP I Like to call the page using header(), but the following error occurs, Cannot modify header information - headers already sent why?. How ...
118
votes
49answers
46k views

What's the best way to separate PHP Code and HTML? [closed]

I really don't like mixing PHP and HTML. Mixing them makes it difficult to maintain both the PHP and the HTML, and it just makes sense to keep the two apart. See also the question on whether PHP is a ...
12
votes
2answers
39k views

PHP Parse HTML code [duplicate]

Possible Duplicate: Best methods to parse HTML How can I parse HTML code held in a PHP variable if it something like: <h1>T1</h1>Lorem ipsum.<h1>T2</h1>The quick ...
33
votes
11answers
6k views

PHP as a template language, or some other PHP templating script?

Is PHP on it's own a good enough templating language, or should one use something like Smarty to write PHP templates in?
10
votes
7answers
2k views

How to replace text URLs and exclude URLs in HTML tags?

I need you help here. I want to turn this: sometext sometext http://www.somedomain.com/index.html sometext sometext into: sometext sometext <a ...
11
votes
4answers
12k views

Convert PDF to HTML [closed]

What is the best solution to convert PDF documents to be viewed in the browser as HTML? The site has several PDF documents and the visitor can click on view as HTML and this should be viewed on the ...
7
votes
7answers
24k views

Convert .doc to html in php

Has anyone found a good class, or other file that will convert a .doc file into html or something that I can read and turn into html? I have been looking around for a couple hours now and have only ...
19
votes
12answers
10k views

PHP: Truncate HTML, ignoring tags

I want to truncate some text (loaded from a database or text file), but it contains HTML so as a result the tags are included and less text will be returned. This can then result in tags not being ...
4
votes
1answer
909 views

Ignore html tags in preg_replace

How do I ignore html tags in this preg_replace. I have a foreach function for a search, so if someone searches for "apple span" the preg_replace also applies a span to the span and the html breaks: ...
16
votes
7answers
8k views

Getting a modified preorder tree traversal model (nested set) into a <ul>

I am trying to get my data which is hierarchically set up with a tree traversal model into an < ul> in order to show on my site. Here is my code: function getCats($) { // retrieve all children ...

1 2 3 4 5 116
15 30 50 per page