Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 17-08-03
Registered User
 
Join Date: Aug 2003
Posts: 218
Thanks: 1
Thanked 0 Times in 0 Posts
Andy is an unknown quantity at this point
  PHP problem with CJ product feed

I am working with the GUS product feeds on CJ (Kays, Argos Additions & Marshall Ward) which I receive in XML format. To extract data to populate a database, I use the $advertisercategory field which works fine when there is no ampersand within it but does not when there is:


For example, in the Kays feed for womens clothing, there is a $advertisercategory field, "shirts & blouses".

However, the if statement below will not evaluate true when it includes an ampersand while it works fine for any $advertisercategory which does not include ampersands. I have tried replacing the & with & but still does not work.

if ($advertisercategory=="shirts & blouses")

Can someone point out the solution to this please?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 18-08-03
ianm's Avatar
Avoiding real work
 
Join Date: Aug 2003
Location: Buckinghamshire
Posts: 1,382
Thanks: 0
Thanked 0 Times in 0 Posts
ianm is an unknown quantity at this point
Have you tried escaping the & by putting \ in front of it?

if ($advertisercategory=="shirts \& blouses")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 18-08-03
Registered User
 
Join Date: Aug 2003
Posts: 218
Thanks: 1
Thanked 0 Times in 0 Posts
Andy is an unknown quantity at this point
Quote:
Originally posted by ianm
Have you tried escaping the & by putting \ in front of it?

if ($advertisercategory=="shirts \& blouses")
Yes, Ian, I've tried that but it does not help.

Thanks anyway.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 18-08-03
ianm's Avatar
Avoiding real work
 
Join Date: Aug 2003
Location: Buckinghamshire
Posts: 1,382
Thanks: 0
Thanked 0 Times in 0 Posts
ianm is an unknown quantity at this point
I just tried the following bit of code -
PHP Code:
    $advertisercategory "shirts & blouses";

    if (
$advertisercategory=="shirts & blouses")
    {
        echo 
"1";
    } 
and it displayed the 1.

From that I would guess that the value being put into $advertisercategory might have the & encoded in some way.

Try echoing $advertisercategory to see what it holds.

Another possibility - have you got any two word categories that don't have & in them? Do they work?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 18-08-03
Registered User
 
Join Date: Aug 2003
Posts: 218
Thanks: 1
Thanked 0 Times in 0 Posts
Andy is an unknown quantity at this point
Quote:
Originally posted by ianm
I just tried the following bit of code -
PHP Code:
    $advertisercategory "shirts & blouses";

    if (
$advertisercategory=="shirts & blouses")
    {
        echo 
"1";
    } 
and it displayed the 1.

From that I would guess that the value being put into $advertisercategory might have the & encoded in some way.

Try echoing $advertisercategory to see what it holds.

Another possibility - have you got any two word categories that don't have & in them? Do they work?
The ampersand in the XML file is encoded as "&" but substituting this for & makes no difference in my if statement.

Echoing $advertisercategory displays shirts & blouses.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 18-08-03
ianm's Avatar
Avoiding real work
 
Join Date: Aug 2003
Location: Buckinghamshire
Posts: 1,382
Thanks: 0
Thanked 0 Times in 0 Posts
ianm is an unknown quantity at this point
Its got me stumped - I just updated my bit of code to -

PHP Code:
    $advertisercategory "shirts & blouses";

    if (
$advertisercategory=="shirts & blouses")
    {
        echo 
"1";
    } 
and it still echoed the 1

The only other thing I can suggest is to try encoding the string you are comparing it to -

if ($advertisercategory==htmlspecialchars("shirts & blouses"))
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 18-08-03
Registered User
 
Join Date: Aug 2003
Posts: 218
Thanks: 1
Thanked 0 Times in 0 Posts
Andy is an unknown quantity at this point
Quote:
Originally posted by ianm


The only other thing I can suggest is to try encoding the string you are comparing it to -

if ($advertisercategory==htmlspecialchars("shirts & blouses")) [/b]
Thanks Ian. Finally solved it with help of htmlspecialchars() but I don't understand what is going on here.
PHP Code:
$html=htmlspecialchars($advertisercategory); $html=trim($html);

if ( 
$html=="shoes &amp+semicolonamp+semicolon boots"
Note that amp+semicolon should be replaced with amp followed by punctuation symbol for semicolon. This message board deletes it.

Thanks for your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use vb.net or php to build product feed site? accelerator Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 2 18-01-05 03:32 PM
Product Data Feed System paidonresults Paid On Results 20 22-12-04 11:21 AM
Problem with Furniture123 Product Feed darrenw TradeDoubler 2 02-10-04 09:44 PM
T-Mobile - Product Feed Problem mexall The Affiliate Marketing Lounge 0 19-07-04 08:29 AM
Product Feed System Release TD Nick TradeDoubler 25 10-04-04 02:10 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7