Copy link to clipboard
Copied
In attempting to parse through my websites contents and extract any information between the <p> tags – I found this function that I have been trying to make work.
I am only getting it to return empty or return ‘Array’ – I have tried numerous things and just can’t seem to get it to work.
Any ideas of what I am missing?
Code Atteched:
Copy link to clipboard
Copied
You're not doing much to help others help you. First, you use a really vague subject line. Next, you say you're trying to get "this function" to work. And then you wrap the code in an attachment that you expect others to download, unzip, and examine.
Yes, I went to the trouble of doing all that, but I don't have the faintest idea what type of text you're passing to the function.
What I can tell you, though, is that if you're getting Array as the result, you can examine the contents of the array by using print_r() to display it.
Copy link to clipboard
Copied
Oh, and another thing. Posting an identical question with a different subject line isn't going to win you many friends either. I have just deleted your duplicate post.
Sorry if this sounds a bit harsh. I know how frustrating it can be if you're struggling with an issue you can't solve, but it's also frustrating trying to help others when they make you run round in circles.
Copy link to clipboard
Copied
Thanks for your time and effort - I will keep trying new things until I get it to work.
Copy link to clipboard
Copied
You Wrote:
You're not doing much to help others help you. First, you use a really vague subject line. Next, you say you're trying to get "this function" to work. And then you wrap the code in an attachment that you expect others to download, unzip, and examine.
Sorry, just did not know what to call it. I had no intention of wrapping the attachment as I thought I only copied it to notepad then uploaded it as a text file. Don’t understand how it got wrapped or what wrapped it.
You Wrote:
Yes, I went to the trouble of doing all that, but I don't have the faintest idea what type of text you're passing to the function.
Thanks for trying.
You Wrote:
What I can tell you, though, is that if you're getting Array as the result, you can examine the contents of the array by using print_r() to display it.
I have printed the content – the content prints OK – I just can’t get the function to find the first <p> tag and extract the text.
You Wrote:
Oh, and another thing. Posting an identical question with a different subject line isn't going to win you many friends either. I have just deleted your duplicate post.
Sorry if this sounds a bit harsh. I know how frustrating it can be if you're struggling with an issue you can't solve, but it's also frustrating trying to help others when they make you run round in circles.
Sorry – but my original post got shoved down. I had this happen before and never received any reply. Was never my intention. I am just trying to teach myself how to code. It has been a struggle but fun in the learning. I try very hard to research ways to fix my own code – but, when I run out of ideas to try or have tried everything I can think of, I come here.
Copy link to clipboard
Copied
brywilson88 wrote:
I have printed the content – the content prints OK – I just can’t get the function to find the first <p> tag and extract the text.
What is it that you're trying to do? If you want the text from the first paragraph in a string that contains HTML, this should do it:
preg_match('/<p>([\w\W]+?)<\/p>/i', $text_to_search, $m);
$first_para = strip_tags($m[1]);
Sorry – but my original post got shoved down. I had this happen before and never received any reply.
If you don't get an answer to a question, post a follow-up in the same thread saying that you still haven't solved the problem. That will move it back up the list.
Unfortunately, there aren't many people active in answering questions in this forum. I have started writing a new book, so won't be able to devote as much time here as I have in recent months.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more