I need a way for PHP to extract the FIRST result's URL from google search results page but I need the Redirect URL.
The search query:
https://www.google.com/search?site=&source=hp&q=what%27s+new+in+windows+phone
I need this link:
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CC0QFjAA&url=http%3A%2F%2Fwww.windowsphone.com%2Fen-us%2Fhow-to%2Fwp8%2Fbasics%2Fwhats-new-in-windows-phone&ei=KL03VeH-Icvfavz-gcAD&usg=AFQjCNEYZMSiSVQ-TKnKgbNNT5CY1o_1kw`
Not the actual link:
http://www.windowsphone.com/en-us/how-to/wp8/basics/whats-new-in-windows-phone
Can anyone suggest anything? I would think you need to use Curl to fetch the page and then use Dom to parse the HTML to give you the redirect url. Just don't know how to do this exactly. Any help would be appreciated.
I have researched quite a bit but have only found questions on how to get the normal URL.