2

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.

Zain
  • 21
  • 3
  • read this couple of times and cant get what is this question about.. – yergo Apr 22 '15 at 15:02
  • I am trying to create a PHP script to pull a google search results page and give me the first result's Redirect URL (the link that when you right click and select copy link on the google results page). – Zain Apr 22 '15 at 15:17
  • Parse the onmousedown attribute and extract the relevant parameters there to construct your url. – Sumurai8 Apr 23 '15 at 05:23

0 Answers0