내가 뭘하고 싶은지 : 최고 게시물의 텍스트 제목을 http://reddit.com/r/worldnews에 가져다가 그 텍스트 만있는 웹 페이지로 출력하십시오.특정 부분 또는 웹 사이트의 div를 얻는 방법
결국 나는 AppleScript cURL을 사용하여 만든 웹 페이지의 텍스트를 가져 와서 출력하고 싶습니다.
나는 버튼을 클릭 할 때 최상위 게시물을 알려주는 스크립트를 만들고 있습니다.
편집 어떤 식 으로든 생각해 볼 수 있으면 같은 것을하고 싶지만 Facebook 알림을 원합니다.
편집 나는 PHP 사이트를 잡아 여기에 출력이 있습니다 http://colejohnsoncreative.com/personal/ai/worldnews.php 이것은 내가 사용하고있는 코드입니다 :
<?php
// Get a file into an array. In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines = file('http://www.reddit.com/r/worldnews');
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
// Another example, let's get a web page into a string. See also file_get_contents().
$html = implode('', file('http://www.example.com/'));
// Using the optional flags parameter since PHP 5
$trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
?>
그래서 내가 출력 사이트의 모든 코드를 얻을 수 있지만, 모든 내가 필요한 이 프로젝트는 내가 그렇게 할 수있는 방법,
<a class="title " href="http://www.dailymail.co.uk/news/article-2219477/Cannabis-factory-couple-gave-400-000-drug-dealing-fortune-poor-Kenyans-jailed-years.html" >British couple who spent most of the money they made from canabis growing on paying for life changing operations and schooling for people in a poor Kenyan village gets sent to prison for 3 years.</a>
내가 던져해야하는 다른 모든 것들입니까?
스크래핑 방법을 살펴보십시오. http://stackoverflow.com/questions/26947/how-to-implement-a-web-scraper-in-php – Steven