Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to get all the visible text from a url. I need to clear all html code and get plain text.
The process does not have to be perfect, but I would like the text to be as clean as possible.
Do you know any way to make it relatively simple?
Thanks!
Javi.
Have a look at strip_tags function.
strip_tags — Strip HTML and PHP tags from a string
It may do the job.
You can get url the value of the query string using $_GET['the names in there']. and use strip_tags to get only the text.
function get_url(){ return $_GET['name userd'];}
and use something like this
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I would like to locate in which page(s) a word is located inside a pdf programatically. My application runs on php over linux.
Is it readable with a text editor?
If it is, you can loop the content and find the string with a regular expression. If the string Is variable and you are the one who wrote the file, try to put some fixed string before.
In some cases under Linux we use pdftops to convert the PDF in a human readable format, find the string looping the content file, and back to PDF with pstopdf.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have reworded this question please disregard original comments
UPDATED QUESTION
If I want to remove one or more characters in a textarea using php, how would I do this?
MY SOLUTION FOR A SINGLE INSTANCE
str_replace("http://","",$_POST['Website']);
How would I remove/replace multiple items or lower upper instances, i.e. HTTP//: http//: HTTPS:// https//: hTTps//: ?
You either should have fixed dictionary for allowed tags and good PCRE knowledge (remember to use lazy quantifiers) or (and this I would advise) use markdown syntax (there are js editors) and compile it in php to valid html.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I need to allow certain html tags (br,p and strong) and I have encountered this code.
(strip_tags($this->parent->content[$i]['text']), $this->parent->config, 'portal_mode_grid_news_text_length', '…').'</p>';
All I need is to allow those tags I have stated previously, but I don't know how to do it.
If you look at the documentation for strip_tags, it shows that the second parameter is "allowed tags", so an example of how to allow br, p and strong is like so:
$string = "Hello<br>";
echo strip_tags($string, "<br><br/><p><strong>");
Adding br and br/ together allows both types of line break as opposed to just one.
(strip_tags($this->parent->content[$i]['text'], "<br><br/><p><strong>"), $this->parent->config, 'portal_mode_grid_news_text_length', '…').'</p>';
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Right now I'm taking text from one form on a page to a separate page and form. I use $_GET to get the variable and just echo out the string between the textarea tags. The problem is formatting in the php seemed to be preserved. I got an if statement in there so it's pretty off.
I tried trimming the variable but that didn't do anything. Then I stripped out the PHP and typed free hand in between the tags. Is there a way to put text in a textarea without formatting?
Make sure your file ending is .php and that you properly open your PHP in the textarea, i.e.:
<textarea>
<?php if(isset($_GET['fieldName']) echo $_GET['fieldName']; ?>
</textarea>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have to get something that has been shared on a website and it changes every day. but i dont know how to do this. how can i do this?
You could download the exact page you're after using file_get_contents
$web = file_get_contents("http://google.com")
You'd then have to strip out whatever it is you want from the rest of the source code on the website. That can be done by using strpos or stripos (ipos being case insensitive) to find its location, and then using substr to extract that part of the string.