Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

PHP Curl problems


ghost's Avatar
0 0

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.