Page 1 of 1
DIY API
Posted: Sun Mar 16, 2008 3:30 pm
by Parody
I'm making a search tool for wikipedia, but it's from my site.
I currently have two problems. This first of which is working out why I can use file_get_contents on google results, but not wikipedia results.
When these two variables are echoed or printed only the google page works:
Code: Select all
$page1 = file_get_contents("http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4HPEB_en-GBGB245GB245&q=devnetwork");
$page2 = file_get_contents("http://en.wikipedia.org/wiki/Special:Search?go=Go&search=devnetwork");
The error for the wikipedia page is:
Code: Select all
Warning: file_get_contents(http://en.wikipedia.org/wiki/Special:Se ... devnetwork) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in (MY DIRECTORY) on line 8
The second problem is how I can select just the results from a wikipedia page. This is more of a concept problem than a coding problem, but it's part of the same thing.
Re: DIY API
Posted: Sun Mar 16, 2008 5:11 pm
by Parody
I realise that this isn't exactly the most efficient way of doing this so I've thought of a better idea, but that has ended with another brick wall.
Why can't I find a basic google web search API? All they have is a frankly terrible Ajax search. That would solve all my problems as with that I could search wikipedia. Windows Live has a working basic web search API, but I would rather use google because of it's robust and efficient nature. I can find some old API code, but I can't get a key so it doesn't work.
Google keep telling us they want developers to make their own tools from their services, but then they go and remove the most basic API available
Great work Google! Lol
Of course if I'm just being stupid and there still is one:
Well done Google, great service.

Re: DIY API
Posted: Sun Mar 16, 2008 5:12 pm
by Christopher
Have you tried cURL or Snoopy?
Re: DIY API
Posted: Sun Mar 16, 2008 5:47 pm
by Parody
Arborint! Great solver of problems

I might as well forget doing as I described in my first post, it's pointlessly difficult and inefficient.
After my monologues above I've managed to find the new basic web search. It's called a raw search, which is exactly what I want.
I know I keep asking for help all the time and sorry if all these problems are annoying, but I guess that everyone can learn from me asking here and It will save me loads of time.
I can't find an example of the raw search that I can modify for my own needs. All I want to do is have a search page with the query defined with GET variables. (I've got it done before with the MSN search you saw before arborint.)
Re: DIY API
Posted: Mon Mar 17, 2008 1:05 pm
by Parody
Google aren't doing anyone any favours with their stupid AJAX search. Why don't they stick to what they know best and just work out how to do ever increasingly more relevant search results instead of muddling with AJAX. I can't see how their new tool could be of any use to a developer as it's all embeded into itself. Why did they remove a perfectly good API that just carried out a search like I want?
If someone has managed to untangled the mess that is the Raw Search part of Google's new API then could you please post your code or point me in the direction on how to do it?
As I put above; all I want is something like an XML feed that I can format easily. I might even pay (within reason; I'm still in high school) someone for this.
I don't see how a javascript API can help me to do this because I want something static.
GOOGLE
I realised this post only contained angry smilies so here's one to brighten the mood.