I have all of my data going into my $html variable.
What i am struggling with is parsing the data, can anyone help me?
I have searched online for this for a good few days but everything i try doesn't work.
I am grabbing the RSS feed by this method:
Getting the HTML from pages using this method:
Just can't seem to figure out how to parse the $ for the information inside of the links.
I have tried doing this but doesn't work:
EDIT:
I now have the page being grabbed and outputting on to the html page where my links are.
i used this code:
Now i need to try figure out how to make it scrape the links on my index.php page that are being scraped from http://iptorrents.com/torrents
What i am struggling with is parsing the data, can anyone help me?
I have searched online for this for a good few days but everything i try doesn't work.
I am grabbing the RSS feed by this method:
PHP:
//RSS Read
$rss = simplexml_load_file('http://iptorrents.com/torrents/rss?l7;l3;l4;u=650269;tp=0186466a09ea2b73868765a1b238e42e');
echo '<h1>'. $rss->channel->title . '</h1>';
foreach ($rss->channel->item as $item) {
echo '<h2><a href="'. $item->link .'">' . $item->title . "</a></h2>";
$x=explode('/',$item->link);
$id=$x[1];
}
Getting the HTML from pages using this method:
PHP:
$html = file_get_html($item->link);
Just can't seem to figure out how to parse the $ for the information inside of the links.
I have tried doing this but doesn't work:
PHP:
foreach($html->find('.imdb-photo') as $tr) {
echo $tr;
}
EDIT:
I now have the page being grabbed and outputting on to the html page where my links are.
i used this code:
PHP:
// Start a cURL resource
$ch = curl_init();
// Set options for the cURL
curl_setopt($ch, CURLOPT_URL, 'http://iptorrents.com/details.php?id=1003336'); // target
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // provide a user-agent
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow any redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the result
// Execute the cURL fetch
$result = curl_exec($ch);
// Close the resource
curl_close($ch);
// Output the results
echo $result;
Now i need to try figure out how to make it scrape the links on my index.php page that are being scraped from http://iptorrents.com/torrents
Last edited: