XeroXer Posted January 18, 2007 Share Posted January 18, 2007 Hi there!I am making a search script for personal use.I am expanding my wallpaper database and feel that searching every name on google, then clicking two links per image and then maybe downloading it takes a lot of time.So what I want the script to do is:* lista a empty textbox where I enter the imagename I want to find.* search images.google.com for that name.* On the scriptsite list all the images in their original size.(*) If more then 50 results list them as text links or thumbnails instead.Anyone feels like helping me with this? Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/ Share on other sites More sharing options...
konnwat Posted January 18, 2007 Share Posted January 18, 2007 not sure if its possible to do the part when you said "get original image size"unless theres a direct link to that on google.but that page html you could parse from will be like[code]<?PHP$google = file("http://images.google.co.uk/images?hl=en&q=".$_POST['search']);?>[/code]and then [color=blue]$google[/color] will be the html code of the google image page. you could parse that to only show thumbnails. Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164073 Share on other sites More sharing options...
XeroXer Posted January 18, 2007 Author Share Posted January 18, 2007 Well google automaticly creates a direct link to the images in it's own top border when you click the thumbnails.Shouldn't I somehow be able to get the direct link from there?Also there check so the images exists so I don't link to a bunch of non existant images. Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164076 Share on other sites More sharing options...
konnwat Posted January 18, 2007 Share Posted January 18, 2007 got it,when you parse the $google thing it should have this[code]<img style="border: 1px solid ;" src="/images?q=tbn:zL2xxNRHzRtnJM:http://cdupload.com/files/download/451_5pjc3/lol.jpg" height="148" width="95">[/code]so if that bit is [color=blue]$imgcode[/color] (you parse it :P)you do[code]<?PHP$stuff = explode(":http://", $imgcode);$stuff = explode("\" height=", $stuff[1]);$imgsrc = "http://".$stuff[0];?>[/code]and your $imgsrc is the link to the fullsize image xD Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164088 Share on other sites More sharing options...
XeroXer Posted January 19, 2007 Author Share Posted January 19, 2007 How do I combine all this with a search function? :)Need all the help I can get.Have done community sites and such but never searched through another site and list the result. Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164328 Share on other sites More sharing options...
XeroXer Posted January 19, 2007 Author Share Posted January 19, 2007 I get an error message. As I can see this means that my webhost does not support other sites through the file command.I also tried file_get_content but the same error there.Can I make it work anyhow or do I have to host the php files myself?[b]Warning:[/b] file(http://images.google.com/images?hl=en&q=gothicmadness) [[color=blue]function.file[/color]]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in [b]/customers/xeroxer.com/xeroxer.com/httpd.www/gimg/gimg.php[/b] on line [b]2[/b] Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164495 Share on other sites More sharing options...
konnwat Posted January 19, 2007 Share Posted January 19, 2007 hhmmmm, never seen that one before ^^might be a setting in your php.ini file that stops you viewing files not on your own server.someone else will need to help you there Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164530 Share on other sites More sharing options...
XeroXer Posted January 19, 2007 Author Share Posted January 19, 2007 Well installed php and all on my laptop and the script kinda works.[code]<?php $sokstrang = file("http://images.google.com/images?svnum=10&hl=en&lr=&btnG=Search&q=".$_POST['search']); foreach($sokstrang as $htmlrader => $enrad) { $expett = explode(":http://", $enrad); $exptva = explode("\" height=", $expett[1]); $bildlank = "http://".$exptva[0]; if($bildlank == "http://") { echo ""; } else { echo $bildlank."<br>"; } }?>[/code]The problem is that google doesn't make every link on one row so the script just lists one row that is mixed up.Can I somehow before I print the info out make every image link on one row? Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164630 Share on other sites More sharing options...
konnwat Posted January 19, 2007 Share Posted January 19, 2007 change file() to file_get_contents()that returns it all in one string instead on an array per line. Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164645 Share on other sites More sharing options...
XeroXer Posted January 19, 2007 Author Share Posted January 19, 2007 then I have to do everything in another way because foreach won't work with a string. Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164652 Share on other sites More sharing options...
XeroXer Posted January 20, 2007 Author Share Posted January 20, 2007 If I have an array and one of the array lines/entrys is really long.Can I make it so that the really long line somewhere splits itself into a new line/entry in the array?If I have this:[code]Array( [a] => 123563573476 [b] => 22323213<>2474361414 [c] => 3432563246324)[/code]Can I with any array command make that into this:[code]Array( [a] => 123563573476 [b] => 22323213< [c] => >2474361414 [d] => 3432563246324)[/code] Link to comment https://forums.phpfreaks.com/topic/34798-search-images-with-large-size-on-google-and-list/#findComment-164944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.