Follow us on Twitter!
Become the change you seek in the world. - Gandhi
Wednesday, April 16, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 15
Guests Online: 11
Members Online: 4

Registered Members: 82810
Newest Member: TheDuke777
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

PHP Curl problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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.

Code

<?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.


Author

RE: PHP Curl problems

hellboundhackersok
Member



Posts: 353
Location:
Joined: 20.09.07
Rank:
Moderate
Warn Level: 95
Posted on 26-04-10 00:57
Look into Regex.
http://www.the-ar. . .rse-links/

http://guyellisrocks.com/regex/get-link-list-from-html-page-with-regular-expressions/

[edit] url tags break second link?


i.imgur.com/qBWHo0R.png


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