mnybud
Members-
Posts
80 -
Joined
-
Last visited
Everything posted by mnybud
-
<?php include("http://www.domain.com/query.php?query=" . keyword() . ">"); ?> doesnt work for me but I think thats what I am looking for.... I dont really understand this example... Example mainfile.php <?php $keyword = "search"; include("included_file1.php"); ?> included_file1.php <?php echo " This is the keyword of mainfile ".$keyword; ?> ...
-
Simple question I think.... I have a existing script that calls a keyword like this... <?php keyword() ?> I have another external script that I call like this normally <?php include("http://www.domain.com/query.php?query=keyword"); ?> I am trying to make this work.... <?php include("http://www.domain.com/query.php?query=<? keyword() ?>"); ?> How do you include PHP within PHP like this?
-
Actually no I learned a lot. Now I know how to do it and apply it properly in the future. I appreciate it.
-
well I still dont get it but I guess I am just to green for this forum since you only point me in a vague direction which is where i was to begin with......remember I am a newbie :-\ thanks anyways, I will just keep reading.......
-
Well I have already grabbed the image url with my script, now I just need to save the image locally...this is the part I am confused by. I honestly dont get how your example works and I have tried it using other ways I found by searching the forums with no success.....lastly using this format... file_put_contents('file_name.jpg', file_get_contents('http://host.com/image_file.png')); not trying to be lazy just getting frustrated.... I will continue looking for the solution.....
-
Ok sorry for the fast bump. So I am sorry I am new to this. Can you please explain in a bit more detail how to configure your script. For example if I wanted to grab this image: http://i21.ebayimg.com/07/i/000/a7/63/131f_12.JPG and save it to a folder on my server. What would I need to change? Can you give me a working example? Sorry I am a bit slow
-
anyone? I know this cant be that hard. I just want to grab selected ebay auction images to add to my site. Any help is appreciated!
-
Hi I am new to PHP and trying to extract images from a website url and save the image file to a directory on my server. So for example I would like to be able to take a url like this: http://www.google.com/intl/en_ALL/images/logo.gif and save the image "logo.gif" to a directory on my server. Can anyone help a newbie out with this?
-
works great! Thanks!
-
still looking for a way to do this if anyone has any suggestions.
-
thanks for the response but that does not work for me :'( This is all it prints in the html code when the term is not available: <p>~GetDEF(some crap)~ </p> I think it might be $article that displays the definition and not $text but I am not sure.
-
I have this Wordpress plugin code (shown below) that pulls definitions from Google. I just call it in my wordpress posts as ~GetDEF(Your_Search_Term)~ and it works great as long as Google has a definition for the term inputed. If Google does not have a definition then it just prints ~GetDEF(Your_Search_Term)~ instead which is kind of ugly. I am wondering is there a way to make it so it displays nothing if the term is not found? I dont know much about PHP so if anyone can help please tell me what I should use to stop this and where I should put it in the code. If you need more info please let me know. Thanks in advance!! Here is the plugin code, its just one php file: //Server Configuration $host = "www.google.com"; $searchStr="http://www.google.com/search?ie=utf8&oe=utf8&q=define:"; function getDEF( $def ) { global $host,$searchStr,$path; $fp = fopen ($searchStr.$def, "r"); if (!$fp) { exit; } $contents =""; $article=""; while (!feof ($fp)) { $contents .= fread($fp, 8192); } if (eregi ("<ul type=\"disc\">(.*)</ul>", $contents, $out)) { $article = $out[1]; } if (eregi ("<li>(.*)<li>", $contents, $out)) { $article = $out[1]; } $article=eregi_replace("<a(.*)[/url]","",$article); $article=strip_tags($article); fclose($fp); $article=trim($article); if($article!=""){ $description= "</br><span class=\"gdescription\"> This definition of ".$def.' is provided by the best search engine in the world, Google!</span>'; $article = "<div class=\"Gdef\">".$def.": ".$article.$description."</div>"; } return $article; } function def_fy( $text ) { $text = preg_replace( "#\~GetDEF\((\S*)\)\~#imseU", "getDEF('$1')", $text ); return $text; } function def_css() { echo " <style type='text/css'> div.Gdef { border: 1px dashed silver; background-color: #f0f0f0; padding:0 2em 0 2em; } .gdescription { font-size: 80%; padding:0 2em 0 2em; } </style> "; } add_action('wp_head', 'def_css'); add_filter('the_content', 'def_fy', 2); add_filter('the_excerpt', 'def_fy', 2); ?>
-
I have this Wordpress plugin code (shown below) that pulls definitions from Google. I just call it in my wordpress posts as ~GetDEF(Your_Search_Term)~ and it works great as long as Google has a definition for the term inputed. If Google does not have a definition then it just prints ~GetDEF(Your_Search_Term)~ instead which is kind of ugly. I am wondering is there a way to make it so it displays nothing if the term is not found? I dont know much about PHP so if anyone can help please tell me what I should use to stop this and where I should put it in the code. If you need more info please let me know. Thanks in advance!! Here is the plugin code, its just one php file: //Server Configuration $host = "www.google.com"; $searchStr="http://www.google.com/search?ie=utf8&oe=utf8&q=define:"; function getDEF( $def ) { global $host,$searchStr,$path; $fp = fopen ($searchStr.$def, "r"); if (!$fp) { exit; } $contents =""; $article=""; while (!feof ($fp)) { $contents .= fread($fp, 8192); } if (eregi ("<ul type=\"disc\">(.*)</ul>", $contents, $out)) { $article = $out[1]; } if (eregi ("<li>(.*)<li>", $contents, $out)) { $article = $out[1]; } $article=eregi_replace("<a(.*)[/url]","",$article); $article=strip_tags($article); fclose($fp); $article=trim($article); if($article!=""){ $description= "</br><span class=\"gdescription\"> This definition of ".$def.' is provided by the best search engine in the world, Google!</span>'; $article = "<div class=\"Gdef\">".$def.": ".$article.$description."</div>"; } return $article; } function def_fy( $text ) { $text = preg_replace( "#\~GetDEF\((\S*)\)\~#imseU", "getDEF('$1')", $text ); return $text; } function def_css() { echo " <style type='text/css'> div.Gdef { border: 1px dashed silver; background-color: #f0f0f0; padding:0 2em 0 2em; } .gdescription { font-size: 80%; padding:0 2em 0 2em; } </style> "; } add_action('wp_head', 'def_css'); add_filter('the_content', 'def_fy', 2); add_filter('the_excerpt', 'def_fy', 2); ?>
-
anyone? ??? I have been fighting this script for too long and need to get some sleep.... If anyone can help I will say THANKS in the morning....... remember I am a PHP newbie so please explain in detail if you can...thanks!
-
thanks but where do i put it?
-
yes I think the script is actually printing the definition... how would I write the if and preg_match statement? radar: not sure where I would put that code... sorry I am just learning.
-
I have this Wordpress plugin code (shown below) that pul definitions from Google. I jut call it in my wordpress posts as ~GetDEF(Your_Search_Term)~ and it works great as long as Google has a definition for the term inputed. If Google does not have a definition then it just prints ~GetDEF(Your_Search_Term)~ instead which is kind of ugly. I am wondering is there a way to make it so it displays nothing if the term is not found? Here is the plugin code, its just one php file: //Server Configuration $host = "www.google.com"; $searchStr="http://www.google.com/search?ie=utf8&oe=utf8&q=define:"; function getDEF( $def ) { global $host,$searchStr,$path; $fp = fopen ($searchStr.$def, "r"); if (!$fp) { exit; } $contents =""; $article=""; while (!feof ($fp)) { $contents .= fread($fp, 8192); } if (eregi ("<ul type=\"disc\">(.*)</ul>", $contents, $out)) { $article = $out[1]; } if (eregi ("<li>(.*)<li>", $contents, $out)) { $article = $out[1]; } $article=eregi_replace("<a(.*)</a>","",$article); $article=strip_tags($article); fclose($fp); $article=trim($article); if($article!=""){ $description= "</br><span class=\"gdescription\"><br>This definition of ".$def.' is provided by the best search engine in the world, <a href="http://www.google.com">Google</a>!</span>'; $article = "<div class=\"Gdef\"><b>".$def.":<br></b>".$article.$description."</div>"; } return $article; } function def_fy( $text ) { $text = preg_replace( "#\~GetDEF\((\S*)\)\~#imseU", "getDEF('$1')", $text ); return $text; } function def_css() { echo " <style type='text/css'> div.Gdef { border: 1px dashed silver; background-color: #f0f0f0; padding:0 2em 0 2em; } .gdescription { font-size: 80%; padding:0 2em 0 2em; } </style> "; } add_action('wp_head', 'def_css'); add_filter('the_content', 'def_fy', 2); add_filter('the_excerpt', 'def_fy', 2); ?>
-
PERFECT! Thanks a lot!
-
Hi I am trying to remove hyperlinks from some of my pages but leave the anchor text. This is what I have so far, which will remove all the urls but it does not leave the anchor text. if(!$edit_link) $article = preg_replace("/<a.*?href=.*?>(.*?)<\/a>/mi","",$article); any help?
-
anyone??? Do you guys need more info or what? Is this possible?
-
cmon guys is this possible or not? I know it cant be that hard....this script does it perfectly http://www.wikifetcher.com/wf/index.php (which I have) but its just not a WordPress plugin which is what I need........anyone have any suggestions?
-
any help?
-
here is some more info: http://dev.wp-plugins.org/wiki/GetWIKI and the authors blog post of the release of the plugin http://saj.in/blog/techtalk/82/getwiki-plugin-for-wordpress.asp I am pretty sure it can be done.....but maybe I am wrong
-
wow fast reply ;D I included the full code below (its short)...I want to be able to do 2 things..... 1. remove all hyperlinks from the grabbed content 2. remove specific sections of the grabbed content like the external link section and error messages Here is an example of something I would like to remove: <div class="messagebox cleanup metadata">This article or section does not cite its <b><a href="http://en.wikipedia.orghttp://en.wikipedia.org/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources">references or sources</a>.</b><br /><small>You can <a href="http://en.wikipedia.orghttp://en.wikipedia.org/wiki/Wikipedia:WikiProject_Fact_and_Reference_Check" title="Wikipedia:WikiProject Fact and Reference Check">help</a> Wikipedia by introducing appropriate citations.</small></div> here is the wordpress plugin code....I think it already removes some things I just cant figure it out ??? thanks for your help! <?php /* Plugin Name: GetWIKI Version: 1.0 Plugin URI: http://saj.in/blog/techtalk/82/getwiki-plugin-for-wordpress.asp Author: Sajin Kunhambu Author URI: http://saj.in/ Description: Get a WIKI article anywhere on yout blog (e.g. ~GetWIKI(Your_Search_Term)~ ) */ //Server Configuration $host = "en.wikipedia.org"; $port = 80; $path = "/wiki/"; //Plugin Configuration $use_cache = true; $cache_life = 10080; $edit_link = false; $retrieved_link = false; $copy_left = "<div class=\"gfdl\">© This material from <a href=\"Wikipediahttp://en.wikipedia.org\">Wikipedia</a> is licensed under the <a href=\"GFDL.http://www.gnu.org/copyleft/fdl.html\">GFDL</a>.</div>"; if( !function_exists(cache_recall) || !function_exists(cache_store) ) { // caching function not available $use_cache = false; } function cleanUp( $article ) { global $edit_link,$retrieved_link,$copy_left; $article = str_replace("\n","",$article); if(preg_match("/^.*(\<\!\-\- start content \-\-\>.*\<\!\-\- end content \-\-\>).*$/i",$article,$match)!=0) $article = $match[1]; $article = preg_replace("#\<\!\-\-.*\-\-\>#imseU","",$article); $article = preg_replace("#\[\!\&\#.*\]#imseU","",$article); if(!$retrieved_link) $article = preg_replace("#\<div\sclass=\"printfooter\".*\<\/div\>#imseU","",$article); if(!$edit_link) $article = preg_replace("#\s*\<div\s*class=\"editsection\".*\<\/div\>\s*#imseU","",$article); $article = str_replace("/w/","http://en.wikipedia.org/w/",$article); $article = str_replace("/wiki/","http://en.wikipedia.org/wiki/",$article); $article = str_replace("/skins-1.5/","http://en.wikipedia.org/skins-1.5/",$article); $article = "<div class=\"wiki\">".$article.$copy_left."</div>"; return $article; } function getArticle( $title ) { global $host,$port,$path,$use_cache,$cache_life; if($use_cache) { $function_string = "getArticle(".$title.")"; if($article = cache_recall($function_string,$cache_life)) return $article; } $out = "GET $path$title HTTP/1.0\r\nHost: $host\r\nUser-Agent: GetWiki for WordPress\r\n\r\n"; $fp = fsockopen($host, $port, $errno, $errstr, 30); fwrite($fp, $out); $article = ""; while (!feof($fp)) { $article .= fgets($fp, 128); } if(substr($article,0,12)=="HTTP/1.0 301") { if(preg_match("/^.*Location\:\s(\S*).*$/im",$article,$match)!=0) { $article = str_replace("http://en.wikipedia.org/wiki/","",$match[1]); $article = getArticle( $article ); } else { $article = "== WIKI Error =="; } } fclose($fp); $article = cleanUp($article); if($use_cache) cache_store($function_string,$article); return $article; } function wikify( $text ) { $text = preg_replace( "#\~GetWIKI\((\S*)\)\~#imseU", "getArticle('$1')", $text ); return $text; } function wiki_css() { echo " <style type='text/css'> div.wiki { border: 1px dashed silver; background-color: #f0f0f0; } div.gfdl { font-size: 80%; } </style> "; } //echo wikify("~GetWIKI(user:Sajin)~"); add_action('wp_head', 'wiki_css'); add_filter('the_content', 'wikify', 2); add_filter('the_excerpt', 'wikify', 2); ?>
-
Hi I have this simple plugin for Wordpress that fetches content from Wikipedia: http://dev.wp-plugins.org/wiki/GetWIKI My question is how can I remove specific content from the extracted content? Such as the wiki navigation, external links, etc? I am guessing it can be done with some sort of string replace but I cant figure it out……any of you PHP gurus help with this?