Bing GET works, Google GET does not

Why do the following three lines not return the webpage from Google, when the second section (from Bing) does work?

– these two lines do not return the page from Google:
url = “http://google.com/#q=nasa+guy
network.request( url, “GET”, M.urlListener )

– these two lines work:
url = “http://www.bing.com/search?q=nasa+guy
network.request( url, “GET”, M.urlListener )

Any ideas out there?  You will notice that you can cut and paste the urls into a browser, and they both work fine.
 

Thanks!

In the google URL, did you mean to use a # symbol? Because I think it should be a ? symbol. Have you tried including www in the URL as well? - Andrew

Thanks for your ideas, Andrew!

I’ve tried many different forms of requests to Google, including trying the subdomain of “https://encrypted.google.com/”.  I believe the problem has to do with the underlying layer.  WGET has the same problem accessing Google, until you invoke the “–user-agent=string” option. 

I imagine that the Corona GET network request is obeying the robot rules found in “http://www.google.com/robots.txt”?  Google has a massive list of restrictions, including “/search”… but Yahoo’s “http://www.yahoo.com/robots.txt” has only four entries.  Shows you the difference in ‘outside access’ policies of the two companies.  Bing has a large robot.txt restriction list too, including “/search”, but the Corona GET works with Bing.  So go figure.

I am wondering if anyone in this forum knows how to send a ‘User-agent’ command via Corona GET network request… perhaps that would work… since the ‘robots.txt’ explaination  does not seem to hold water.

Interesting.  Are you experiencing this issue on the Corona Simulator (Mac or Windows?), the device (iOS or Android?), or both?

The following one-line main.lua works for me for both google and bing in the Corona Simulator on Windows (using build 1107).

[lua]

network.request(“http://www.google.com”, “GET”, function(event) print(event.response) end)

[/lua]

  • Andrew

Andrew… yes, that will work, but if you access any Google search page (http://google.com/#q=nasa+guy), it will not…

:frowning:

Whoops, apparently I forget what the issue was!  :-)

I agree, I get no response from google when I include a query term.

You can send a user-agent header (or any header you like) using the params.headers option for the network.request call (http://docs.coronalabs.com/api/library/network/request.html).

  • Andrew

I am playing with the header stuff now… it does not seem to have a one-for-one with the WGET parameters, so it may be a slow go.  Thanks for your help, Andrew!

In the google URL, did you mean to use a # symbol? Because I think it should be a ? symbol. Have you tried including www in the URL as well? - Andrew

Thanks for your ideas, Andrew!

I’ve tried many different forms of requests to Google, including trying the subdomain of “https://encrypted.google.com/”.  I believe the problem has to do with the underlying layer.  WGET has the same problem accessing Google, until you invoke the “–user-agent=string” option. 

I imagine that the Corona GET network request is obeying the robot rules found in “http://www.google.com/robots.txt”?  Google has a massive list of restrictions, including “/search”… but Yahoo’s “http://www.yahoo.com/robots.txt” has only four entries.  Shows you the difference in ‘outside access’ policies of the two companies.  Bing has a large robot.txt restriction list too, including “/search”, but the Corona GET works with Bing.  So go figure.

I am wondering if anyone in this forum knows how to send a ‘User-agent’ command via Corona GET network request… perhaps that would work… since the ‘robots.txt’ explaination  does not seem to hold water.

Interesting.  Are you experiencing this issue on the Corona Simulator (Mac or Windows?), the device (iOS or Android?), or both?

The following one-line main.lua works for me for both google and bing in the Corona Simulator on Windows (using build 1107).

[lua]

network.request(“http://www.google.com”, “GET”, function(event) print(event.response) end)

[/lua]

  • Andrew

Andrew… yes, that will work, but if you access any Google search page (http://google.com/#q=nasa+guy), it will not…

:frowning:

Whoops, apparently I forget what the issue was!  :-)

I agree, I get no response from google when I include a query term.

You can send a user-agent header (or any header you like) using the params.headers option for the network.request call (http://docs.coronalabs.com/api/library/network/request.html).

  • Andrew

I am playing with the header stuff now… it does not seem to have a one-for-one with the WGET parameters, so it may be a slow go.  Thanks for your help, Andrew!