When i am trying to get a google image search page in PHP it always has the OLD LAYOUT. Is there any way to change to the NEW LAYOUT? I am using the file_get_contents
function to get the page.
Asked
Active
Viewed 219 times
0

Nimmi
- 181
- 1
- 2
- 10
-
The difference between the "new layout" and "old layout" is JavaScript. Temporarily disable JS in your browser and view the page again, and you'll see the "old layout". Because JavaScript is not executed when you get the page with `file_get_contents`, you just get the regular HTML content. – Don't Panic Dec 23 '16 at 17:57
-
[Here is a question](http://stackoverflow.com/questions/28505501/get-the-content-text-of-an-url-after-javascript-has-run-with-php) about how to get the page after the script has executed. Keep in mind that trying to scrape Google can get you blocked pretty quickly, though. Maybe there's a better way to accomplish whatever you're using this for? – Don't Panic Dec 23 '16 at 18:05
-
@Don'tPanic The think is i need a way to get squared images. I already tried the google image api and the google custom search api but none of them have a feature to search for squared images (i also tried to search for icons, yes they are square but they have a low resolution) – Nimmi Dec 23 '16 at 18:12
-
Oh yeah, it looks like they don't have the option to search by aspect ratio. I don't know if it's any good or how much it costs, but it looks like Microsoft's image search API does: https://msdn.microsoft.com/en-us/library/dn760791.aspx#Filter%20Query%20Parameters I don't know if that's useful for you not. – Don't Panic Dec 23 '16 at 18:36
-
@Don'tPanic i already searched for other image search providers and also found bing. But you have to pay for the api and i am a student and i don't really have to money for that. It's just a hobby project. – Nimmi Dec 23 '16 at 18:41