Page 1 of 8 12345678 LastLast
Results 1 to 25 of 199
  1. #1
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Building UNIQUE autoupdating bulletproof datafeed sites that sell.
    [PART 1 - SERVER SETUP]
    Hi all,

    In this post I covered some nuts and bolts methods that will help make your datafeed site unique and I offered to provide working code for these examples if anyone was interested so here we go. I order for any of my examples to work you must have the following setup on your server.

    You will need to have PHP and MySQL as well as access to cronjob and .htaccess. If you haven't got cronjob don't worry I will show you how to auto update your sites from any scheduler you run on your computer.

    I like to make all my pages look static with no variables so I add this line to httpd.conf using a shell editor. (If you don't have access to httpd.conf just add the line to .htaccess)

    AddType application/x-httpd-php .htm .html

    This tells the server to handle all files with a .htm or .html extension as PHP files allowing you to run PHP code on pages that appear static to search engines and visitors alike.

    two more lines to add are:

    Options +FollowSymlinks
    RewriteEngine On

    These will be covered later when we get into mod-rewrite so just add them for now.

    You will also need to add a MySQL database on your server, create a user with full privileges and add the user to the database.

    Next you will need to import your datafeed into a standardized database. I will continue in a new post as this next subject is going to take some space.

  2. #2
    Newbie
    Join Date
    May 21st, 2005
    Location
    Western Australia
    Posts
    24
    I use Windows and ASP.Net so I can provide a 'translation' when you are finished :-)

  3. #3
    Full Member heisje's Avatar
    Join Date
    January 18th, 2005
    Posts
    314
    .

    dirk,

    GREAT!!

    some people are very eager to hear more from you . . .

    thanks for everything,
    including the "other" post.

    heisje
    mod_rewrite fan



    .
    Last edited by heisje; July 2nd, 2005 at 10:44 AM.

  4. #4
    Troll Killer and best Snooper!
    I decide when the pigs fly!
    Rhea's Avatar
    Join Date
    January 18th, 2005
    Location
    New York, USA
    Posts
    6,195
    Dirk, it's all kind of alphabet soup to me but I did wonder if you could explain what you mean by "bulletproof."

  5. #5
    ABW Ambassador Jane's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,350
    Looking good, axiously awaiting part II

  6. #6
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    I'm anxious to see the Kevlar part...
    There is no knowledge that is not power. ~Hemingway

  7. #7
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,015
    A side note: SymLinksIfOwnerMatch is safer than FollowSymLinks.

  8. #8
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Part 2
    [PART 2: AN INTRODUCTION TO POPULATING A DATABASE FROM A FLAT DATAFEED FILE AND HOW TO USE THE DATABASE]

    Sorry about the late response. I have not been getting topic subscriptions. I started writing part II the other day and realized I was introducing so much at one time that I was having to stop and define every new item and for the next post that would have included no less than 50 definitions. So I am going to change course and start with something much simpler and expand from there. I'll introduce a random quote generator first as this uses a 3 column database and import script. Once that has been covered, writing a fully blown datafeed import script will be much easier to understand. It is great to see coding experts in here like FFoc and mgrcentral as I do not at any stage claim to be an expert and they can straighten me out and provide alternatives wherever they deem necessary:

    Dirk, it's all kind of alphabet soup to me but I did wonder if you could explain what you mean by "bulletproof."~Rhea
    By bulletproof I meant that it will include multiple safeguards at every level protecting it from automated duplicate content filters. As to the alphabet soup. Once I have finished I will run a separate thread that will be a glossary of terms for this one.

    So here we go with a very basic three column database import script:

    At this point you should have a database setup on your server. Make a note of the user name, password and database name you used to create it.

    Next create a blank text file in word pad or whatever and fill it with say 10 rows of data. Leave the first line blank. (This is so we can remove the first line in datafeed examples later that usually have Merchant column names in them) In this example lets use authors and quotes separated by a tab. Yes I know only two columns. This is because a database needs a primary key which is a column in which every row is unique from any other. We are going to auto generate this as you will see in a few steps. name the text file example.txt and upload it to your server (doesn't matter where).

    Now here is the script. It is heavily commented for your benefit. Anything after a // (comment tag) can be removed. Write this into a file called example.php.

    File Names for example:

    example.txt - Flat file containing data
    example.php - import script
    main table - example
    temp table - example_temp

    PHP Code:
     <?
              
              
    // Connect to the database. Replace User name, Pass and DatabaseName
           // with yours.
             
    $dbh=MySQL_connect ("localhost""<UserName>""<Password>"
           or die (
    'I cannot connect to the database because: ' mysql_error());
              
    mysql_select_db ("<DatabaseName>");
              
              
    // Create a variable called $FeedFile and fill it with location to file.
              
    $FeedFile 'http://<path to file>/example.txt';
              
              
    // Delete the temporary table if it exists.
              
    mysql_query("drop table example_temp");
              
              
    // create a new temporary database that we will modify.
              
    mysql_query("CREATE TABLE example_temp (
              
              //create id column of Integer type that may not be null and automatically
           // increment it for every row
                  id INT NOT NULL AUTO_INCREMENT,
              
              //  set the id column as the Primary key
                  PRIMARY KEY (id),
              
              // create author column as variable character less that 100.  It cannot be
           // null but if it is blank set nothing in it.
                  Author varchar(100) NOT NULL default '',
              
              // create Quote column and copy contents exactly (blob)
                  Quote blob NOT NULL)"
    ) or die(mysql_error());
              
              
    // create feed variable and use fopen to open FeedFile in read only mode.
              
    $feed fopen($FeedFile'r');
              
              
    // create two variables we will use later and set them to 0
              
    $rowNum 0;
              
    $recCount 0;
              
              
            
    // this is our looping code that reads the text file. Set a variable called
         // data and use fgetcsv to reed the feed. Maximum line length it 3000
        // characters and the separator is tab.
              
    while($data fgetcsv($feed3000"\t")){
              
              
    // imports every line except the first
                  
    if($rowNum 0){
              
            
    // creates temporary variables and fills them with the data from the column
           // in the feed file specified adding slashes to non standard characters.
           // Remember row one is zero, row two is one. etc.
                      
    $iAuthor            addslashes($data[0]);
                      
    $iQuote    addslashes($data[1]);
              
            
    // as we loop through each line in the feed insert into the Author and Quote
           // columns the contents of the iAuthor, iQuote temporary array.
                      
    $sql mysql_query("insert into example_temp (Author, Quote)
                      values
                      ('
    $iAuthor', '$iQuote')") or die(mysql_error());
              
    // add one to the recCount variable on every iteration
                      
    $recCount++;
                  }
    // close the if loop
              
              // add one to the rowNum variable on every iteration
                  
    $rowNum++;
              } 
    // close the while loop
              
              // Delete the main table
              
    mysql_query("drop table example");
              
              
    // and rename the temporary table so it becomes the main table
              
    mysql_query("ALTER TABLE example_temp RENAME example") or 
       die(
    mysql_error());
              
              
    // set variables for the reporting email
              
              
    $to "<Your Email Address>";
              
    $subj "Example Database Table Update Report";
           
    $mssg "This is an automated email. The example Table update has 
          completed successfully.\n\nThe total number or items loaded was
          
    $recCount.\n\n";
              
    $hdrs "From: $to\n";
              
    mail($to$subj$mssg$hdrs);
              
              
    // close the feed file we opened with fopen.
              
    fclose ($FeedFile);
              
              
    // display completion message on screen
              
    echo "Example Import Completed Successfully"?>
    Here is an uncommented version for simplicity:
    PHP Code:
     <?
            $dbh
    =mysql_connect ("localhost""<UserName>""<Password>"
          or die (
    'I cannot connect to the database because: ' mysql_error());
          
    mysql_select_db ("<DatabaseName>");
              
              
    $FeedFile 'http://<path to file>/example.txt';
              
              
    mysql_query("drop table example_temp");
              
    mysql_query("CREATE TABLE example_temp (
                  id INT NOT NULL AUTO_INCREMENT,
                  PRIMARY KEY (id),
                  Author varchar(100) NOT NULL default '',
                  Quote blob NOT NULL)"
    ) or die(mysql_error());
              
              
    $feed fopen($FeedFile'r');
              
              
    $rowNum 0;
              
    $recCount 0;
              
              while(
    $data fgetcsv($feed3000"\t")){
                  if(
    $rowNum 0){
                      
    $iAuthor            addslashes($data[0]);
                      
    $iQuote    addslashes($data[1]);
                      
    $sql mysql_query("insert into example_temp (Author, Quote)
                      values
                      ('
    $iAuthor', '$iQuote')") or die(mysql_error());
                      
    $recCount++;
                  }
                  
    $rowNum++;
              }
              
              
    mysql_query("drop table example");
              
    mysql_query("ALTER TABLE example_temp RENAME example") or die(mysql_error());
              
              
    $to "<Your Email Address>";
              
    $subj "Example Database Table Update Report";
           
    $mssg "This is an automated email. The example Table update has
           completed successfully.\n\nThe total number or items loaded was 
          
    $recCount.\n\n";
              
    $hdrs "From: $to\n";
              
    mail($to$subj$mssg$hdrs);
              
    fclose ($FeedFile);
              echo 
    "Example Import Completed Successfully"?>
    So upload example.php to your server and run it by loading the URL to it in your browser.

    NOTES: fopen. fclose is exchangeable with fzopen fzclose which would open GZIP files instead of text ones. You can specify any separator if fgetcsv.

    Here is a quick example of how to use the contents of this new table on your pages.

    [This code goes on your actual pages.]

    PHP Code:
     <?
              
    // Connect to the database. Replace UserName, Pass and Database Name with yours.
     
    $dbh=mysql_connect ("localhost""<UserName>""<Password>") or die ('I cannot connect to the database because: ' mysql_error());
              
    mysql_select_db ("<DatabaseName>");
              
              
    // if there is no items variable. create one and fill it with 0.
                  
    if(!isset($items)){$items 0;}
              
              
    // create a variable called Quote and select one RANDOM row from the example table
              
    $Quote mysql_query("SELECT * FROM example ORDER BY RAND() Limit $items, 1"):
              
    ?>
              <HTML>
              <h2>Quote</h2>
              <p><? while($quo mysql_fetch_array ($Quote)){
                   echo 
    $quo["Quote"],'</p><p align=right>',$quo["Author"];
                   }
              
              
    ?></p>
              </HTML>
    And there you have it. I will wait one day to clear up any questions or comments before showing how to use what I have shown you here to handle a full blown datafeed.

    Please jump in to improve my code. I have not tested it so there may be one or two bugs. If it does not work for you let me know and I will repair.

    All the best,

    Dirk
    Last edited by Leader; July 7th, 2005 at 01:01 AM. Reason: By Dirk's request

  9. #9
    Marketing Mistress Lectrickitty's Avatar
    Join Date
    June 15th, 2005
    Location
    Broken Bow, OK
    Posts
    336
    Thanks for posting this. This is exactly what I've been looking for.

  10. #10
    Full Member heisje's Avatar
    Join Date
    January 18th, 2005
    Posts
    314
    .

    aha, simplicity itself !
    and I was worrying it might have been more complex .
    nah, piece of cake . . .


    heisje


    .

  11. #11
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Part 3: Fullblown Datafeed Import
    Glad you are finding it easy heisje

    If you have got the last import to work, believe it or not you are ready to write a full blown datafeed import script. We are going to use the last script and expand on it. For this example I will use a standard commission junction feed that is sent in GZIP format and is tab delimited.

    Remember, to swap the script to handle gzip format instead of uncompressed text format all we do is swap fopen to gzopen and fclose to gzclose (simple huh? )

    Let us begin by looking at the first line in a CJ feed which is the column descriptions as named by CJ. We don't actually want to include this line when we pull the feed so in our loop statement we used "if($RowNum > 0){}" which means don't include the first line.

    Here is the first row. I have added numbers beside each one for your reference so you don't forget column one in MySQL (like most programming languages) is column 0):

    PROGRAMNAME(0) PROGRAMURL(1) LASTUPDATED(2) NAME(3) KEYWORDS(4) DESCRIPTION(5) SKU(6) MANUFACTURER(7) MANUFACTURERID(8) UPC(9) ISBN(10) CURRENCY(11) SALEPRICE(12) PRICE(13) RETAILPRICE(14) FROMPRICE(15) BUYURL(16) IMPRESSIONURL(17) IMAGEURL(18) ADVERTISERCATEGORY(19) THIRDPARTYID(20) THIRDPARTYCATEGORY(21) AUTHOR(22) ARTIST(23) TITLE (24) PUBLISHER(25) LABEL(26) FORMAT(27) SPECIAL(28) GIFT(29) PROMOTIONALTEXT (30) STARTDATE(31) ENDDATE(32) OFFLINE(33) ONLINE(34)

    Upon handling many feeds you will become aware that many if not most of these columns are unused and this differs from merchant to merchant. So you decide which ones you need for a merchant and ignore all the others.

    FYI I will be adding an auto incrementing primary key but if a merchant uses item SKUS you should do away with the auto incrementing primary key and set the SKU as the primary key. The benefit of this is you have a unique identifier per item that does not change from import to import.

    LASTUPDATED is great if it is used as you can use it to display a ''NEW ITEM" image for example. Categories or brands are great for building automatic menus and sales, retail, price columns are great as you can use them to show discounts, savings, items on sale etc.

    In this example for simplicity's sake i will use a few basic columns. You can call them whatever you want and rearrange them however you want.

    These are the column names I will use:

    Name = Column 3
    Merchant = 0
    Description = 5
    Sku = 6
    Brand = 7
    SalePrice = 12
    Price = 13
    RetailPrice = 14
    LinkURL = 16
    ImpressionURL = 17
    ImageURL = 18
    Currency = 11
    Category = 19

    As I am using the last script I will not add comments. For comments check the previous post. So we need to setup columns, name them and tell MySQL what they will contain. Then we setup temporary variables and tell the script where to fill them from on each iteration of the import loop. Finally we take the contents of the temporary holding variables, turn them into an array and fill the array contents into the correct columns we created earlier.

    So here we go:

    PHP Code:
    <?
                  $dbh
    =mysql_connect ("localhost""<UserName>""<Password>")
                or die (
    'I cannot connect to the database because: ' mysql_error());
                
    mysql_select_db ("<DatabaseName>");
          
                    
    // File can be anywhere on the Internet
                    
    $FeedFile 'http://<path to file>/YourCJFeed.txt.gz';
                   
                    
    mysql_query("drop table example_temp");
                    
    mysql_query("CREATE TABLE example_temp (
               id INT NOT NULL AUTO_INCREMENT,
              PRIMARY KEY (id),
              Name varchar(100) NOT NULL default '',
              Merchant blob NOT NULL,
              Description blob NOT NULL,
              Sku varchar(50) NOT NULL default '',
              Brand varchar(50) NOT NULL default '',
              SalePrice varchar(7) NOT NULL default '0.00',
              Price varchar(7) NOT NULL default '0.00',
              RetailPrice varchar(7) NOT NULL default '0.00',
              LinkURL blob NOT NULL,
              ImpressionURL blob NOT NULL,
              ImageURL blob NOT NULL,
              Currency blob NOT NULL,
              Category varchar(100) NOT NULL default '')"
    ) or die(mysql_error());
                   
                    
    $feed gzopen($FeedFile'r');
                   
                    
    $rowNum 0;
                    
    $recCount 0;
                   
                    while(
    $data fgetcsv($feed3000"\t")){
                        if(
    $rowNum 0){
          
                  
    $iName            addslashes($data[3]);
                  
    $iMerchant            addslashes($data[0]);
                  
    $iDescription            addslashes($data[5]);
                  
    $iSku            addslashes($data[6]);
                  
    $iBrand            addslashes($data[7]);
                  
    $iSalePrice            addslashes($data[12]);
                  
    $iPrice            addslashes($data[13]);
                  
    $iRetailPrice            addslashes($data[14]);
                  
    $iLinkURL            addslashes($data[16]);
                  
    $iImpressionURL            addslashes($data[17]);
                  
    $iImageURL            addslashes($data[18]);
          
    $iCurrency         addslashes($data[11]);     
                  
    $iCategory            addslashes($data[19]);
          
             
    $sql mysql_query("insert into example_temp (Name, Merchant, Description, Sku, Brand, SalePrice, Price, RetailPrice, LinkURL, ImpressionURL, ImageURL, Currency, Category)
                  values
             ('
    $iName', '$iMerchant', '$iDescription', '$iSku', '$iBrand', '$iSalePrice', '$iPrice', '$iRetailPrice', '$iLinkURL', '$iImpressionURL', '$iImageURL', '$iCurrency', '$iCategory')") or die(mysql_error());
                  
    $recCount++;
                    }
                   
                    
    mysql_query("drop table example");
              
    mysql_query("ALTER TABLE example_temp RENAME example") or die(mysql_error());
                   
                    
    $to "<Your Email Address>";
                    
    $subj "Commission Junction Database Table Update Report";
                 
    $mssg "This is an automated email. The CJ Table update has
                 completed successfully.\n\nThe total number or items loaded was
                
    $recCount.\n\n";
                    
    $hdrs "From: $to\n";
                    
    mail($to$subj$mssg$hdrs);
                   
    gzclose ($FeedFile);
               echo 
    "CJ <Merchant Name> Import Completed Successfully"?>
    And there you have it!

    Once you have this done we can move into the good stuff. The next part will be about something I have often seen on here referred to as "the holy grail". That is on the fly, super fast multiple search and replace of data to make your feed site unique. The method I will show you will work on all aspects of the site including content, page names, auto navigation etc.

    Can I please request at this point that a moderator turn on my PMs as this would make life easier to deal with specific questions (And also maybe add the 1,040 posts to my total from my old handle that I can't seem to login to for the life of me ).

    All the best,

    Dirk
    Last edited by Leader; July 7th, 2005 at 01:02 AM. Reason: By Dirk's request

  12. #12
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    Can I please request at this point that a moderator turn on my PMs as this would make life easier to deal with specific questions (And also maybe add the 1,040 posts to my total from my old handle that I can't seem to login to for the life of me ).
    Haiko's the one you need to ask for that...

    You might want to ask in a different thread, since he might miss that request in here.
    There is no knowledge that is not power. ~Hemingway

  13. #13
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    On another note, I see you're using "blob" for most of the fields.
    From all I've read, to be able to add a Fulltext Search, they need to be "text"... are you using some other kind of site search, or no search, or~?

    Not saying I'm any kind of coding pro (not by a long shot), or that your way isn't better. After all, you got it in the index without screwing up your site, so that's definitely a great thing!!

    Just wondering how you handle the site search (if any) without "text" being the designation, is all.
    There is no knowledge that is not power. ~Hemingway

  14. #14
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Quote Originally Posted by Leader
    On another note, I see you're using "blob" for most of the fields.
    From all I've read, to be able to add a Fulltext Search, they need to be "text"... are you using some other kind of site search, or no search, or~?
    Hi Leader,

    Nope I use VarChar for most of the fields. Blob only for information i want duplicated exactly like URLs and also descriptions as it is very hard to guess their maximum length and declare the same using varchar.

    Blob is indeed fully searchable. The difference in MySQL between blob and for example VarChar is that blob is case sensitive while varchar is not. If you want to increase your search speed or the production of page builds based on select statements I would turn any column you use with regularity into a Key. Although you require one primary key you can have as many Keys as you want on top of this. What this does is it tells MySQL to create a separate file that contains only the column that is keyed and upon a search this file is searched before the database in its entirety. As the file is much smaller, Search times are greatly reduced.

    The real reason I use blob? Haven't figured out any other way yet I will research text as a MySQL field option.

    As to how I handle site search from a search box perspective for an end user, I will always integrate a Merchant's search tool into my site and get a visitor to use that as this means as soon as they click 'search' a cookie is set and any subsequent sale becomes mine.

    Cheers,

    Dirk

  15. #15
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Interim Notes
    Here are a few interim notes before we move on.

    Automation: To automate this script simply call it from cronjob to run once a day or however often the feed is renewed. In my example the file is called example.php and is located on your site. If you do not have access to cronjob, no problem. Simply add a line to any scheduler you have on your computer to load that web page once a day and that will do it just as well.

    What if you want to make universal changes to the database? No problem. Simply add these lines to the script above the line where you drop the main table and rename it.

    Say you have a direct feed where CJPID needs to be replaced with your PID.

    mysql_query("update example_temp set LinkURL = replace(LinkURL,'CJPID','<yourPID>')") or die(mysql_error());

    What if you want to change a category from some name like Sport into Sporting Goods:

    mysql_query("update example_temp set Category = replace(Category,'Sport','Sporting Goods')") or die(mysql_error());

    Say you have a merchant that lists items more than once in different currencies. In this example we want to keep USD but delete GBP (Great Britain Pounds)

    mysql_query ("DELETE from example_temp WHERE Currency Like 'GBP'");

    I'm sure you can figure it out from here.

    VERY IMPORTANT: Whenever you alter your table, you end up with alot of blank lines and fields creating overhead that slows your table down. To fix this add this line after you have finished all your changes:

    mysql_query("OPTIMIZE TABLE example_temp") or die(mysql_error());

    Now you can go ahead and drop the old main table and rename the temp table as the main one. Making all changes to a temporary table and then renaming in this way is great as there is no down time!

    Cheers,

    Dirk

  16. #16
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Cripes! My eyes cross when I even try to read it. I am sure it is good.

    Guess, I should have Peter read this.
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  17. #17
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    Okay, another question has sprung to mind:

    PHP Code:
    // File can be anywhere on the Internet
                    
    $FeedFile 'http://<path to file>/YourCJFeed.txt.gz'
    CJ's FTP server requires your password, etc. in order to get in. How do you automate getting the feed from them?

    I like the idea of changing a temp table instead of the main one. I never knew how to keep the downtime from showing...

    Cripes! My eyes cross when I even try to read it. I am sure it is good.~Ssanf
    LOL here I was going to tell you to never mind that book I mentioned, just read THIS!

    But, any kind of language seems overwhelming if you haven't done anything with it before. I'm sure there was a time when HTML seemed like a strange entity, too...
    Last edited by Leader; July 6th, 2005 at 10:38 PM.
    There is no knowledge that is not power. ~Hemingway

  18. #18
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Hi Leader,

    You could try this:

    PHP Code:
    <?php
        
        $login 
    'login';
        
    $password 'password';
        
    $server 'ftp.merchant.com';
        
    $datafeed_file "datafeed.csv";
            
        
    unlink("datafeeds/$datafeed_file");
        
    $path "wget -P db ftp://$login:$password@$server/datafeed/$datafeed_file";
        `
    $path`;
        
        
    $FeedFile "datafeeds/$datafeed_file";
        
    $fp fopen($FeedFile'r');
        
        while(
    $data fgetcsv($fp3000))
        {
            
    $sku $data[0];
            
    $name addslashes(preg_replace("/\"/"''$data[1]));
        
            
    // And so on...
        
    }
        
     
    ?>
    Sorry this is a snippet I found that uses wget to dl the feed to your own server and then you specify the local location of the feed. I don't need to do this/haven't done this before as I get a push feed from CJ meaning it is delivered to my ftp server in advance.

    Leader could I ask you pretty, pretty please to go back through this thread and change the tags around my php code to php code tags. The reason they are not now is I didn't know there was such a thing!!!

    ssanf,

    Nice to see you
    Last edited by Dirk Gardner; July 6th, 2005 at 10:59 PM.

  19. #19
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Quote Originally Posted by Leader
    I'm sure there was a time when HTML seemed like a strange entity, too...
    That is very true. I had to learn it because I needed to teach it to PSanf as one of his home schooling courses. Peter says he is going to help me set up a site and teach it to me. So, if I am not too bad a student, I may learn it yet.

    But, you know there comes a time when you just don't want to be bothered learning new stuff. In 61 years haven't I, yet, learned enough to get by? When do we get let off the hook on this education stuff? I am sick of learning new stuff. I want to rest on my laurels, now.
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  20. #20
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    I've changed those tags now
    Thanks for the way to auto-pull the feeds. If anything unexpected happens when I test it, I'll let you know. But, it looks like it'll work.

    But, you know there comes a time when you just don't want to be bothered learning new stuff. In 61 years haven't I, yet, learned enough to get by? When do we get let off the hook on this education stuff?~Ssanf
    I don't think we ever do. When I got out of high school and I still did not know everything, and even with college I STILL did not know everything, I started looking around and realized that NOBODY knows everything, no matter how old they are, how much school they've had, or what their life experience are!

    And unless you know everything, there's always something else to learn...

    Think of it like this, at least it keeps your brain from atrophying!
    There is no knowledge that is not power. ~Hemingway

  21. #21
    Night Owl Dragon Dame's Avatar
    Join Date
    January 18th, 2005
    Posts
    155
    More Questions
    Hello Dirk. I am sorry to bump up this older thread, but I needed to ask you, can this script be modified to pull an ftp datafeed that is a regular .zip file? I don't have any merchants that offer .tar files to be able to use gzip.

    This would really help me be able to auto updated my feeds more.

    I would like to graduate from WebMerge and step up to complete an actual automated datafeed site.
    Stand Tall ~Eradicate A Parasite And Put The "Affiliate" Back In Affiliate Marketing!

  22. #22
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    I think to open zip files you need to use zip_open (I think if I'm not wrong if you have older versions of php you can't use this command)

    so you change the command

    $feed = gzopen($FeedFile, 'r');

    TO

    $feed = zip_open($FeedFile, 'r');

    Don't quote me though - I know php but I've never done it before...Dirk's a lot more knowledgeable than I am...

    Oscar

  23. #23
    Full Member heisje's Avatar
    Join Date
    January 18th, 2005
    Posts
    314
    stupid comment deleted by heisje

  24. #24
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Quote Originally Posted by Dirk Gardner
    Say you have a direct feed where CJPID needs to be replaced with your PID.

    mysql_query("update example_temp set LinkURL = replace(LinkURL,'CJPID','<yourPID>')") or die(mysql_error());
    Dirk, very good of you to walk us through this. I might add that you will want to do your Impressionurl also.

    In the past I had downloaded my CJ feeds, modified them with <mypid> and uploaded them. If I forgot to change the pid for the side I just deleted and re-imported after making the changes. It only took me about 10 minutes to do this so I never worried about it.

    Lately I've been forcing myself to learn more php, mysql so I tried the update like your example. I think it takes a whopping 4 seconds to do the same thing.

    I forgot the Impressionurl so my Impressions/click-thru's were looking WAY off.

    When I do it I didn't use the "or die(mysql_error());" Can I ask why you use it without anny error message? I thought the only think it was used for was to return an error message so you knew the command didn't work..

  25. #25
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Honiara, Solomon Islands
    Posts
    1,085
    Quote Originally Posted by hotspice
    When I do it I didn't use the "or die(mysql_error());" Can I ask why you use it without anny error message? I thought the only think it was used for was to return an error message so you knew the command didn't work..
    Removing it is fine, however due to the nature of the search and replace it is useful to leave in there so if you type in something wrong, you get an error message. The part of the code that creates the error message is mysql_error(). You may be more comfortable seeing it used like this:

    PHP Code:
    <? or die ('Update Search and Replace failed because: ' mysql_error());?>
    The first part is just echoed on screen. The actual error message is created by mysql_error().

    Cheers,

    Dirk

+ Reply to Thread
Page 1 of 8 12345678 LastLast

Similar Threads

  1. How to make UNIQUE sites using datafeeds??
    By Million-Dollar-Baby in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: December 7th, 2008, 07:34 PM
  2. New Unique Sites Wanted
    By mailman in forum Midnight Cafe'
    Replies: 2
    Last Post: November 14th, 2006, 11:00 PM
  3. Building Quality Datafeed Sites - Which Way?
    By Morethanable in forum Programming / Datafeeds / Tools
    Replies: 11
    Last Post: October 3rd, 2006, 12:00 AM
  4. What do you do to make your datafeed sites unique?
    By MoneyBusiness in forum Programming / Datafeeds / Tools
    Replies: 9
    Last Post: May 24th, 2006, 12:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •