-2

there is someone who knows how to write php in a script to convert a site's news into RSS feeds. For example, feed43.com, try it out to understand the mechanism. Thank you.

I tried to write this code, but I'm not capable. Help me please, it's not difficult.

function example_extract_link_feedrss($url){
  $link = file_get_contents($url);
   $str = trim(preg_replace('/\s+/', ' ', $str));
    preg_match('/\<h3\>"\>(.*)/i',$str,$titleNoticeRSS);
    return $titleNoticeRSS[1];
  }
}
  • "I'm not capable" isn't really an answerable question. What specifically is the problem? For what sample input is your code producing unexpected or incorrect output? Include those details in the question. – David May 22 '17 at 14:19
  • The code I entered was an example of how to extract a data with preg_match. I wanted someone to write a script that extracted all the news from a site in RSS feeds. – Mary Larey May 22 '17 at 14:21
  • Ok, and in what way is it failing for you? We can help with code that isn't working as expected, but you have to describe the problem that you're observing with that code. Stack Overflow isn't really a replacement for debugging. – David May 22 '17 at 14:22
  • `"I wanted someone to write a script ..."` - Then you have entirely misunderstood what Stack Overflow does. This is not a free code-writing service. You are encouraged to make some attempt and when you encounter a problem we can help with that. But if you're looking for someone to work for you, then what you're looking to do is hire a programmer. There are "freelancer" websites where you can do that, this is not one of them. – David May 22 '17 at 14:24
  • I want that code I put in, extracting all the news from a site with a loop. That is, every time he meets

    . Sorry for wrong English.

    – Mary Larey May 22 '17 at 14:26

1 Answers1

0

Do NOT use regex to parse HTML! Please see here: RegEx match open tags except XHTML self-contained tags

Instead, use the DOM classes: http://php.net/manual/en/book.dom.php

delboy1978uk
  • 12,118
  • 2
  • 21
  • 39