boemboem Posted January 14, 2009 Share Posted January 14, 2009 Hello all, I'd like to provide people with a certain image, not just image, but a image with a unique numer something like this: <img src="http://www.mydomain.nl/pl016342345.gif" width="30" height="30" /> This image will prove to me that that person keeps his promise. Is there a way I can check if this is on his website with the above link provided by me? Any help would be great Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/ Share on other sites More sharing options...
premiso Posted January 14, 2009 Share Posted January 14, 2009 curl or file_get_contents then do a stristr on the results, if it is there he is good if not he is not good. Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-737232 Share on other sites More sharing options...
boemboem Posted January 15, 2009 Author Share Posted January 15, 2009 Could you please explain how to do this? Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-737546 Share on other sites More sharing options...
boemboem Posted January 15, 2009 Author Share Posted January 15, 2009 Can I use this?/ <? $keyword_to_find = "http://www.google.nl/logos/nl_doodle4google09.gif";s if (is_keyword_found($keyword_to_find)== true) { print "Image gevonden!"; //found } else { print "Image niet gevonden."; //not found } //Verify if any line from the data file is existing in the given string $data = explode("\n",$data); foreach ($data as $line) { if (trim($line)!="") { if (!stristr($keyword,$line)===FALSE) { return true; } } } return false; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-737556 Share on other sites More sharing options...
boemboem Posted January 15, 2009 Author Share Posted January 15, 2009 ok, I tried this, will this work?? This is the imagecheck.php <? $keyword_to_find = "http://www.another-domain.com"; if (is_keyword_found($keyword_to_find)== true) { print "image found!"; //found } else { print "sorry, image not found."; //not found } function is_keyword_found($keyword) { $filename = 'datafile.txt'; //Check if we have local copy of the remote data file saved in our server if (!file_exists($filename)) { //Create data file in our server $data = get_remote_data($filename); } else { //Read last modification date of the data file $lastmodified = date("d/m/y",filemtime($filename)); $today = date("d/m/y"); //Compare with today's date to make sure if //the file has been updated today if ($lastmodified != $today) { //Update data file on server $data = get_remote_data($filename); } else { //Read data file from server $data = file_get_contents($filename); } } //Verify if any line from the data file is existing in the given string //return (stristr($data,$keyword) === FALSE)?false:true; $data = explode("\n",$data); foreach ($data as $line) { if (trim($line)!="") { if (!stristr($keyword,$line)===FALSE) { return true; } } } return false; } ?> The content of the datafile.txt http://www.keurmerk.coldcharlie.nl/keurmerkimages/12342345.gif Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-737561 Share on other sites More sharing options...
boemboem Posted January 15, 2009 Author Share Posted January 15, 2009 this is what I'm trying to do: I want to have a image found in this domain: http://www.gadgetgarden.nl/index.php the image location is here: http://www.gadgetgarden.nl/wp-content/uploads/2009/01/pro-motion_toetsenbord.jpg This is what I did: <? $keyword_to_find = "http://www.gadgetgarden.nl/index.php"; if (is_keyword_found($keyword_to_find)== true) { print "Keurmerk aanwezig!"; //found } else { print "Keurmerk niet aanwezig!"; //not found } function is_keyword_found($keyword) { $filename = 'datafile.txt'; //Check if we have local copy of the remote data file saved in our server if (!file_exists($filename)) { //Create data file in our server $data = get_remote_data($filename); } else { //Read last modification date of the data file $lastmodified = date("d/m/y",filemtime($filename)); $today = date("d/m/y"); //Compare with today's date to make sure if //the file has been updated today if ($lastmodified != $today) { //Update data file on server $data = get_remote_data($filename); } else { //Read data file from server $data = file_get_contents($filename); } } //Verify if any line from the data file is existing in the given string $data = explode("\n",$data); foreach ($data as $line) { if (trim($line)!="") { if (!stristr($keyword,$line)===FALSE) { return true; } } } return false; } ?> And the datafile.txt http://www.gadgetgarden.nl/wp-content/uploads/2009/01/pro-motion_toetsenbord.jpg Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-737568 Share on other sites More sharing options...
boemboem Posted January 15, 2009 Author Share Posted January 15, 2009 Can anyone help me please? Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-737915 Share on other sites More sharing options...
boemboem Posted January 16, 2009 Author Share Posted January 16, 2009 What I try to accomplish is the following. I have a image on my own server <img src="http://www.my-domain.nl/images/29092008.jpg" width="60" height="60" /> the image above, this code I provide to people. The thing I want to do is to check if this piece of code excists on an other domain. for example http://www.another-domain.com. This is a part of a code I found. And edited it to fit for my own use. With the code. <? $keyword_to_find = "http://www.another-domain.com"; if (is_keyword_found($keyword_to_find)== true) { print "Keurmerk aanwezig!"; //found } else { print "Keurmerk niet aanwezig!"; //not found } function is_keyword_found($keyword) { $filename = 'datafile.txt'; //Compare with today's date to make sure if //the file has been updated today //Read data file from server $data = file_get_contents($filename); } } //Verify if any line from the data file is existing in the given string $data = explode("\n",$data); foreach ($data as $line) { if (trim($line)!="") { if (!stristr($keyword,$line)===FALSE) { return true; } } } return false; } ?> The tekst wich is in the datafile.txt http://www.my-domain.nl/images/29092008.jpg Can somebody explain to me how I can make this work?? Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-738210 Share on other sites More sharing options...
premiso Posted January 16, 2009 Share Posted January 16, 2009 <?php $domainCheck = "http://anotherdomain.com"; $codeToCheck = '<img src="http://www.my-domain.nl/images/29092008.jpg" width="60" height="60" />'; $html = file_get_contents($domainCheck); if (stristr($html, $codeToCheck) !== false) { echo 'Success, they have the code'; }else { echo 'Failed, no code found.'; } ?> Simple as that. Note the img code must be exactly like that or it will return false. Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-738394 Share on other sites More sharing options...
boemboem Posted January 18, 2009 Author Share Posted January 18, 2009 It's indeed simpler then what I found and it's perfect. You kan check it here if you like http://keurmerk.coldcharlie.nl/chkimg.php Quote Link to comment https://forums.phpfreaks.com/topic/140853-no-script-just-a-question-how-to-check-for-certain-image/#findComment-739923 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.