Results 1 to 8 of 8

 

Thread: Need Urgent Help - Parse Error

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Hi,

    I parsed my xml product feed but when i uploaded it to my domain and open it, it comes up with an error:

    Parse error: syntax error, unexpected T_STRING in /www/zxq.net/x/c/l/xclusivegigs/htdocs/XclusiveGigs.php on line 14

    The pHp file is below:

    PHP Code:
    <?php
         
    //connects to our database
         
    require_once('db_connect.inc');
         
    db_connect();
         
         
    //create instance of XMLReader
         
    $xmlReader = new XMLReader();
         
         
    //define the filename we wish to write to and the url we wish to download from
         
    $filename "Ticketmaster_UK_Events.xml";
         
    $url "http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&REVERSEMAPXML=yes&PRODUCTDB_ID=306"
         
         
    //this creates the file "feed_download".xml and takes he contents from the URL and stores them into the file
        
    file_put_contents(‘Ticketmaster_UK_Events.xml’file_get_contents(http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&REVERSEMAPXML=yes&PRODUCTDB_ID=306));

         //read in xml file
         
    $xmlReader->open(‘Ticketmaster_UK_Events.xml’);
         
         
    //loop to read in data
         
    while ($xmlReader->read())
               {

                                   switch (
    $xmlReader->name)
                                          {
                                                            
    //this finds the parent node for each instnc of a product
                                                            
    case 'product':
                                                                 
    //this initialises the xml parser
                                                                 
    $dom = new DOMDocument();
                                                                 
    $domNode $xmlReader->expand();
                                                                 
    $element $dom->appendChild($domNode);
                                                                 
    $domString utf8_encode($dom->saveXML($element));
                                                                 
    $product = new SimpleXMLElement($domString);
                                                                 
                                                                 
    //read in data
                                                                 
    $product_code $product->product_code;
                                                                 
    $product_name $product->product_name;
                                                                 
    $leval1 $product->level1;
                                                                 
    $description $product->description;
                                                                 
    $short_deeplink $product->buyat_short_deeplink_url;
                                                                 
    $oldstyle_deeplink $product->old_style_deeplink_url;
                                                                 
    $image_url $product->image_url;
                                                                 
    $currency $product->currency;
                                                                 
    $availability $product->availability;
                                                                 
    $apr_full $product->APR_full;
                                                                 
    $apr $product->APR;
                                                                 
    $balancetransfer_free $product->BT_Free;
                                                                 
    $interest_free_period $product->interest_free_period;
                                                                 
    $credit_limit $product->credit_limit;
                                                                 
    $benefits $product->benefits;
                                                                 
    $company_text $product->company_text;
                                                                 
                                                                 
    //insert query
                                                                 
    if(strlen($product_code) > 0//product_id is chosen because there must be an id for each product
                                                                                          
    {
                                                                                               
    $query mysql_query("REPLACE INTO seatwave
                                                                                                      (product_code, product_name, level1, description, short_deeplink, oldstyle_deeplink, image_url, currency,
                                                                                                      availability, apr_full, apr, balancetransfer_free, interest_free_period, credit_limit, benefits, company_text)
                                                                                                      
                                                                                                      VALUES ('$product_code', '$product_name', '$level1', '$description', $short_deeplink', '$oldstyle_deeplink',
                                                                                                      '$image_url', '$currency',
                                                                                                      '$availability', $apr_full', '$apr', '$balancetransfer_free', '$interest_free_period', '$credit_limit', '$benefits',
                                                                                                      '$company_text')"
    );
                                                                                               echo 
    $product_name "has been inserted </br>";
                                                                                          }
                                                            break;
                                          }
                                   }
    ?>
    Can someone please tell me how to fix this?

    Thank You

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Location
    Swansea
    Posts
    75
    Thanks
    3
    Thanked 6 Times in 5 Posts
    Yuh have forgotten the ; at the end of this line

    $url = "http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6 624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&R EVERSEMAPXML=yes&PRODUCTDB_ID=306"

    so should be

    $url = "http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6 624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&R EVERSEMAPXML=yes&PRODUCTDB_ID=306";

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Location
    Swansea
    Posts
    75
    Thanks
    3
    Thanked 6 Times in 5 Posts
    Sorry missed this one also

    replace your existing
    file_put_contents(‘Ticketmaster_UK_Events.xml’, file_get_contents(http://feeds.perfb.com/index.php/dow...CTDB_ID=306));

    With

    file_put_contents(‘Ticketmaster_UK_Events.xml’, file_get_contents('http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6 624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&R EVERSEMAPXML=yes&PRODUCTDB_ID=306'));

  4. The Following User Says Thank You to awgthomas For This Useful Post:

    Aditya7 (27-10-09)

  5. #4
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks that seemed to work

  6. #5
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Location
    Swansea
    Posts
    75
    Thanks
    3
    Thanked 6 Times in 5 Posts
    No probs...

    I can see that you are keen to develop your own business and looking to use PHP as your language, to which I can't fault you on both

    It also appears you are new to development(as the 2 errors are quite simple PHP omissions when scripting to begin with ) and there is so much to learn, but you can get by using Google to search for code.

    I would recommend you have a good look through PHP: Hypertext Preprocessor as i treated it as my bible for many years..and still do.

    Hopefully you should have a these products displayed on your page by now.

    You do have the option of reading (parsing) from an XML file and it is one that i feel may be the quickest solution to get you going. As previuosly stated in another post, it is often better to drop the feed into you own database and then you can perform all sorts of magic with SQL.

    however, bare in mind that the larger the XML feed is, the more processing your site will be required to perform and that will only result in a slow service which may put off visitors to your site.

    Hope these little tips help and good luck and happy coding :tup

  7. #6
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Location
    Swansea
    Posts
    75
    Thanks
    3
    Thanked 6 Times in 5 Posts
    You are posting details about your database that will allow ANYBODY to access your database...You replace you details here as this will avoid anyone hacking to bits your db and screwing up all your hard work!!

    If i was you i would seriously go down the XML route as you are learning one skill set at a time....with DB work you are doubling your workload !!!

    Notices are not that great an issue...they are due to undefined variables.

    Pheww.. the more I am going on the more you really have your work cut out..

    You are jumping into a deep swimming pool without being able to swim !!!
    You have bags of time to start learning PHP so I would start by developing a simple PHP site before diving head first into affiliate marketing.

    Try building a simple PHP, MySQL site and take what you learn from that and move forward

    There are so many areas of development that you are trying to hit on by doing this that you are unlikely to be learning, just regurgitating code.

    I would start bygoogling all Warnings (not Notices yet ) that you are getting and tick them off one by one.

    Sorry i can't be of more help, but you really need to get to a certain level before dealing with so much code etc.

  8. #7
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I am following the SEP09 BUY.at integration of product feed guide so not really sure on what to do, the feed is the only thing i need to program as the designing is easy

    Was the warning due to the password or username being incorrect?

    Thanks Anyway

  9. #8
    Registered User

    Status
    Offline
    Join Date
    Oct 2009
    Location
    Swansea
    Posts
    75
    Thanks
    3
    Thanked 6 Times in 5 Posts
    Yes you did have a connection error there !!



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 11
    Last Post: 27-10-09, 12:07 PM
  2. CSS Parse Error - No Idea Why!
    By Renners in forum Programming
    Replies: 1
    Last Post: 13-07-09, 06:07 PM
  3. Can anyone parse OMG XML Editorial for me?
    By DanielCoe in forum OMGPM.com, OMG Network
    Replies: 10
    Last Post: 26-08-06, 11:22 AM
  4. How do you parse datafeeds?
    By Swiss in forum Programming
    Replies: 16
    Last Post: 11-01-06, 11:56 AM
  5. Parse error: unexpected T_ENDWHILE
    By morleymouse in forum Programming
    Replies: 2
    Last Post: 14-07-05, 11:07 PM

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2