mercredi 25 mars 2015

How find all links (URL) in a webpage and add a string at the end of all of them?

Hey so what I am trying to acheive is get all links on page using



preg_match_all("/<a(?:[^>]*)href=\"([^\"]*)\"(?:[^>]*)>(?:[^<]*)<\/a>/is"


and then adding "|Cookie=" to the end of each url while keeping the source of page the exact same.


For example: Let's say I find the following links in my scraped page "http://ift.tt/LWARzD and http://ift.tt/1E2xVOT"


I want them to be changed to "http://ift.tt/1Ixu8ro" and "http://ift.tt/1E2xW59"


So sorry if my question is too vague. I have no clue how to start :(


Aucun commentaire:

Enregistrer un commentaire