Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
PHP Curl problems
Hi everyone, there's a website that has about 10 text links per page, on a few hundred pages that I'm trying to get, and since there's no anchor tag I was having problems figuring out how to get the string, I made some code to get every link on the page which works, but I want to get all of the specific text links, here's what I have.
<?php
$request_url ='http://example.com/?m=123456&paged=1';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url); // The url to get links from
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // We want to get the respone
$result = curl_exec($ch);
$regex='|<a.*?href="(.*?)"|';
preg_match_all($regex,$result,$parts);
$links=$parts[1];
foreach($links as $link){
echo $link."<br>";
}
curl_close($ch);
?>
So any ideas on how to make this code get a string like http://targetpage.com/file/2155/15850-rar.html - I tried regular expressions but I couldn't get it to work.
Thanks for any help.
Look into Regex. http://www.the-art-of-web.com/php/parse-links/
http://guyellisrocks.com/regex/get-link-list-from-html-page-with-regular-expressions/
[edit] url tags break second link?