Join us at IRC!
Ideas are far more powerful than guns.
Friday, May 25, 2012
Navigation
Members Online
Total Online: 33
Web Spiders: 16
Guests Online: 32
Members Online: 1

Registered Members: 70208
Newest Member: andresuran
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

PHP Curl problems

a-hack
Member

Posts: 253
Location:
Joined: 29.05.06
Rank:
HBH Guru
Posted on 25-04-10 23:36
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 expresblockedsions but I couldn't get it to work.

Thanks for any help.


Atlanta Web Design
Author

RE: PHP Curl problems

hellboundhackersok
Member



Posts: 353
Location:
Joined: 20.09.07
Rank:
God
Warn Level: 95
Posted on 26-04-10 00:57
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-expresblockedsions/

[edit] url tags break second link?



Paint.NET Pwns


Edited by hellboundhackersok on 26-04-10 00:58
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.