I’m not a good coder, but I seem to have gotten lucky with this one. A great plugin by Zhou Wei called GetDef, a [tag]Wordpress[/tag] [tag]plugin[/tag], was causing my site problems.  I kept getting this error:

Warning: fopen(http://www.google.com/search?ie=utf8&oe=utf8&q=define:) failed to open stream: Success in /home/ggxf/public_html/blog/wp-content/plugins/GetDEF/GetDEF.php on line 19

I never had this problem before and it seemed to appear for “no reason”.  Then I started to analyze my site and I realized that I was starting to use this plugin more frequently and more [tag]GetDef[/tag] calls were being performed on each page.  I began to think that maybe [tag]Google[/tag] was timing out because of the quickness of the calls or perhaps it was thinking it was getting spammed.

Long story short: I added a “usleep(100)” line to make the plugin pause a 10th of a second after each “fetch”.

Here is the code I used:

function def_fy( $text ) {
    $text = preg_replace(

return $text;

Also Google decaprecated some values (no longer being used) that were in the search string so I pulled them from the “$searchStr” value and changed to this:


Finally, I fixed a spacing problem with the “term” tag and bracket  and changed a line of code by adding a space:

article = “<div class=\”Gdef\”><img align=\”left\” src=\””.$imgpath.”\”><b>[“.$def.”] </b>”.$article.$description.”</div>”;

Note: I added a space after the ] and just before the </b>

That’s it! 

I am going to keep a .zip of the changes here for on https://mustech.net for a little while.
You can down load the changes I made in a zip file by clicking here: Click for it!  (I am not sure how long I am going to keep this link).

Again, this has fixed my problem, I am not sure if it will fix yours! Also, you may be able to change the “usleep” value to less and have it work as well. 

I also have updated ZHOU wei about this on his site.  It’s in Chinese and you can visit it here: http://www.ennonce.com/blog/

                          ~J. Pisano

Print Friendly, PDF & Email