• 0

[php] Links to array


Question

2 answers to this question

Recommended Posts

  • 0

Use fgets() or cURL to get the source code of an html page. Then use some basic string manipulation commands such as substr() (allows you to grab a part of the string) and stripos() (lets you find something in a string).

Using those commands will allow you to search through the code for a href="" tags. Once you find the location of those tags (looping through the entire source), you can parse the string based on that and put them into an array. It's not that difficult really.

If you need working examples you can go to PHP.net and look up the functions I recommended. If you can't figure out the logic behind what I just briefly explained then I can provide you with some actual code to get you started.

Link to comment
Share on other sites

  • 0
Use fgets() or cURL to get the source code of an html page. Then use some basic string manipulation commands such as substr() (allows you to grab a part of the string) and stripos() (lets you find something in a string).

Using those commands will allow you to search through the code for a href="" tags. Once you find the location of those tags (looping through the entire source), you can parse the string based on that and put them into an array. It's not that difficult really.

If you need working examples you can go to PHP.net and look up the functions I recommended. If you can't figure out the logic behind what I just briefly explained then I can provide you with some actual code to get you started.

if you could provide the code would be fantastic. Thank you

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.