Jump to content

mnybud

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by mnybud

  1. I have a very large text file, nearly 1 gig. I need to add some text before each line in the file. So for example I have 1 2 3 4 and I simply want a1 a2 a3 a4 I can do this in excel but since the file is so big it will have to be split into a million pieces in order to load and will take me forever. Is there a way to do this in php easily?
  2. ok thanks for your help. I will explore more. You gave me a good start
  3. they use the same cookie. I login once and then I am good to view all the urls. Also I dont really want to load the page in the browser, just go through the list of urls as quick as possible. wont actually loading them be slower than just processing them in the background skipping images and stuff?
  4. the cookie is for just my site (lots of urls from same domain). so how would that work? how does it login to set the cookie originally? thanks again for your help, helping me learn
  5. Is it possible to set a cookie with the script so it logged me into my site before running the links?
  6. thanks a lot, looks like what I need. I will try it out. Thank you!!
  7. Can someone help me out. I am trying to figure out how to do something I think is pretty simple but I am a total PHP newbie. All I want to do is take a list of urls I have in a text file and load each of them one at a time like you would a browser but as fast as possible. Can someone supply me with code to do this or help point me in the right direction.
  8. I have a page with an iFrame on it that loads pretty slow. Is there a way to preload the whole page, including the iframe, before displaying to to the user? Or another solution would be to put a "loading" message where the iframe is. Either would work although I would prefer to preload the whole page. Any help?
  9. actually no, working great! I had a space after my terms causing a mismatch. Thanks so much guys!! Cheers!
  10. ok so i set it up on my server but it doesnt seem to function properly. It creates the new file ... terms3.txt ... but it includes all the terms from terms1.txt and doesn't remove the ones listed in terms2.txt Do I need to modify this code further? <?php $terms1 = file('terms1.txt'); $terms2 = file('terms2.txt'); $terms3 = array_diff($terms1,$terms2); $fp = fopen('terms3.txt','w'); fwrite($fp,implode('',$terms3)); fclose($fp); ?>
  11. ok gonna try it out. thanks a lot guys!
  12. thanks! ?How would i put them in arrays properly?
  13. I am trying to accomplish the following. I have very limited PHP knowledge so I don't know if this is even possible. Here is what I am tryign to do...... I have 2 text files of keywords. 1 keyword per line in each file. I want to compare the two text files and remove any duplicate terms found in both the lists. So for example. If terms1.txt has.... term1 term2 term3 term4 and terms2.txt has..... term2 term3 I would want a 3rd file generated from the comparison called terms3.txt which would only have term1 term4 Is this possible? Can anyone help me out?
  14. Is it possible with PHP to take a text file of urls, 1 per line, and extract only the ones with .com extension? If so can anyone help point me in the right direction?
  15. $query = " SELECT * FROM Auto_database_final WHERE id='$ID' " ; Thats it....Thanks so much!!
  16. This is what I am trying to do.... I have this page setup which is working fine to display the links to the specific cars details. http://www.rebuilt-transmissions-fast.com/database3.php?page=1 If you click one though you will see it displays the wrong car data, ID1 shows ID2, etc. I tried all the solutions posted and many of my own and they all return just ID1 data not the correct ID's data. That make sense? the closest I have come to getting it right is with the code on my first post which is what is currently live.
  17. I thought the same but if I do that it returns ID1 no matter what url I use. This... ORDER BY ID ASC LIMIT 1 Also returns ID1 each time.
  18. Thanks but neither of those work for me. When I use either one I just get the 1st record no matter what ID I put in the url. I left it broke so you could look.... http://www.rebuilt-transmissions-fast.com/database3.php?page=1 http://www.rebuilt-transmissions-fast.com/database.php?ID=8 http://www.rebuilt-transmissions-fast.com/database.php?ID=22
  19. I have the following code: <?php mysql_connect("localhost", "root", "password") or die(mysql_error()); mysql_select_db("transmission") or die(mysql_error()); $ID=$_GET['ID']; $query = "SELECT * FROM Auto_database_final ORDER BY ID ASC LIMIT $ID, $ID"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); print "<h1>" . $row['year_maker_model']. " </H1><P><b>Model:</b> ". $row['submodel']. " <BR><br /><b>Body Style:</b> ". $row['body_style']. " <BR><br /><b>Engine:</b> ". $row['engines']. " <BR><br /> <b>". $row['year_maker_model']. " Transmission: </b>" . $row['transmissions']. " <BR><br /><b>DriveTrain:</b> ". $row['drivetrains']. " <BR><BR><b>Performance and Efficiency:</b> ". $row['performance_efficiency']. " <BR><br /><b>Handling and Breaking:</b> ". $row['handling_riding_beaking']. " <BR><br /><b>Exterior:</b> ". $row['exterior_aerodymamics']. " <br /><BR><b>Interior:</b> ". $row['interior']; ?> It should display the data by the ID in the mysql database but it is always one off.....so page.php?ID=1 displays ID2 content and page.php?ID=2 displays ID3 content and so on. You can see it here... http://www.rebuilt-transmissions-fast.com/database3.php?page=1 I am assuming I have something wrong but I cant figure it out for the life of me....any help?
  20. Hey guys I have this script that will check a sites indexed pages in Google using the Google API. Right now it requires that you enter one domain in a form and hit submit. Is there a way for me to change this so it loads a list of domains from a text file instead? I am guessing yes but I have been having a tough time getting it working right. Here is the working script that is using the form...If anyone could help me out I would REALLY appreciate it <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Google API DEMO- Number of indexed pages from a site</title> <META NAME="description" CONTENT=" This demo will output the number of links indexed by Google in a site"> <META NAME="keywords" CONTENT="Google API DEMO"> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <!-- *** This simple demo is put together to illustrate the use of Google API (to query the number of indexed pages) by KC TAN at http://www.kchut.com. No linkback is required but would appreciate if the publisher can leave this notice intact. Thank you. *** --> </head> <body> <?php // include the nusoap class, can be downloaded from http://sourceforge.net/projects/nusoap/ require_once('lib/nusoap.php'); if(isset($_POST['submit'])) { //trim the user's url $qurl=trim($_POST['url']); $mq='site:'.$qurl; $parameters = array( 'key'=> 'Your Google API Key', 'q'=> $mq, 'start'=> '0', 'maxResults'=>'10', 'filter'=> 'false', 'restrict'=>'', 'safeSearch'=>'false', 'lr'=>'', 'ie'=>'', 'oe'=>'' ); //Create a new soap client, feeding it googlesearch.wsdl $soapclient=new soapclient('http://api.google.com/GoogleSearch.wsdl','wsdl'); //save the results into $results array $results = $soapclient->call('doGoogleSearch',$parameters); //save the total number of pages indexed $no_pages=$results['estimatedTotalResultsCount']; // test if any results were returned if(is_array($results['resultElements'])) $enable=1; else $enable=2; } ?> <div align="center"> <form name="demoform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table> <tr><td>Site URL:</td><td><input type="text" name="url" size='45' value="<?php echo $_POST['url']; ?>"> (Eg. http://www.useseo.com)</td></tr> <tr align="center"><td colspan="2"><input type="submit" name="submit" value="Search"></td></tr></table> </form> <?php if($enable==1) echo'<p style="margin-top:15px;">Google has indexed <b>'.number_format($no_pages).'</b> pages from the above domain.</p>'; elseif ($enable==2) echo'<p style="margin-top:10px;color:red;">There are no results returned.</p>'; ?> </body> </html>
  21. Can someone help me here or at least point me in the right direction? I have the following code which takes the name of the domain from the url and extracts Overture keyword suggestions and prints them to a text file. I would like it to dig one level deeper instead of just returning the primary results. For instance if the domain was credit-cards.com it returns "credit cards, credit card offers, apply for a credit card, etc" and writes them to the text file. I want to not only save those terms to my text file but also search those terms in Overture and add them to the keyword text file as well so I can get the "long tail" terms as well as the main ones. Here is the code I am currently using. Any suggestions? <?php // Set your file here. $myFile = "keywords.txt"; // Get domain name preg_match('@^(?:www\.|)([^\.]+)\.@i', $_SERVER['HTTP_HOST'], $matches); $domain_name = $matches[1]; // Kepp only letters and numbers $domain_name = preg_replace('/[^a-z0-9_]/i',' ',$domain_name); $domain_name = ucwords($domain_name); echo "<br>Domain: $domain_name<br>"; // Get overture suggestions (using the lib you found) require_once('keyword_suggest.class.php'); $obj = new keyword_suggest($domain_name); $result = NULL; if ($obj->execute()) { $result = $obj->get_keywords_weights(); // Write to file if all good. if (is_array($result)) { $fh = @fopen($myFile, 'w') or die("Can't open file: " . $myFile); foreach ($result as $key => $value) { fwrite($fh, ucwords($key) . "\n"); } fclose($fh); } } else { echo 'Could not load the overture page, please try again in a few seconds.'; } // Let the people know we finished. echo "All good.<br>" . rand(); ?>
  22. Can someone tell me how I would alter this code, which displays a list of my site pages as a single sitemap page, to generate multiple sitemap pages (like 20 links per sitemap page or something) with next and previous buttons? Trying to avoid having a ton of links on one page.....any help is appreciated! <?php // SITEMAP function sitemap($return = false) { $sitemap = ''; $sitemap = ''; $keyword_file = file(FILE_KEYWORDS); $keyword_file = array_map('trim', $keyword_file); $keyword_file = str_replace(" ", "-", $keyword_file); asort($keyword_file); $letters = ""; $letters = explode(" ", $letters); foreach($letters as $letter) { $links[$letter] = ''; foreach($keyword_file as $keyword) { if (preg_match("/^$letter/i", $keyword)) { $links[$letter] .= $keyword." "; } } $links[$letter] = rtrim($links[$letter]); if ($links[$letter] !== '') { $links2 = explode(" ", $links[$letter]); $letter = str_replace("\d","#",$letter); $sitemap .= "\n"."<a name=\"".$letter."\" id=\"".$letter."\"></a>"; $sitemap .= "\n"."<h1>".$letter."</h1>"; foreach($links2 as $keyword) { $keyword = str_replace("-", " ", $keyword); $sitemap .= "\n".'<a href="http://'.THIS_DOMAIN.'/'.str_replace(" ", "-", $keyword).'" title="'.$keyword.'">'.$keyword.'</a><br />'; } } } $sitemap .= "\n"; if ($return !== true) { print $sitemap; } else { return $sitemap; } } ?>
  23. can anyone help me with this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.