/    Sign up×
Community /Pin to ProfileBookmark

html table response from another site.

I have a vendor that supplies products to us, they gave us an API to contact them to see if the products about to be ordered are avaliable. I setup a CURL connection to the form and it works fine. The problem is the vendor does not respond with an XML or even a CSV, they respond with an HTML table

exmple of a response.

[code=php]
<table border=1 cellpadding=1 cellspacing=0><TR bgcolor=dfdfdf><TD align=center>ItemID</TD><TD align=center>Item</TD><TD align=center>Order Qty.</TD><TD align=center>Avail. Qty.</TD><TD align=center>Price</TD></TR>

<TR bgcolor=92F59E><TD align=center>368</TD><TD align=center>DELUXE 35mm CAMERA KIT</TD><TD align=center>1</TD><TD align=center>45</TD><TD align=center>$12.00</TD></TR>

</table>
[/code]

Now this is just 1 product, I can send them unlimited products and they will respond in this format but just add more rows. How in the world would I go about reading each colum so I can see what they are responding with. I am expecting to have to learn regex (which i have been putting off), but any suggestions would be awesome.

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@chazzyMay 30.2006 — 1) tell them to respond in pure xml format

2) you can parse the HTML response like XML. you'd just have to count the <TD> children for each <TR>
×

Success!

Help @cafrow spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...