/    Sign up×
Community /Pin to ProfileBookmark

downloading HTML source

When I click “view source” on this page:
[url]http://www.starcitygames.com/magic/standard/22684_Tracking_The_Storm_Lessons_Learned_In_Boston.html[/url]

I see this code:

[code=html]tooltip=”Birds%2Bof%2BParadise”>Birds of Paradise</a><br />1 <a class=”card_popup” href=”http://sales.starcitygames.com/cardsearch.php?game_type=1&singlesearch=Consecrated+Sphinx”
rel=”
<div style=’text-align: center; height: 360px; padding: 2px’>
<a href=’http://sales.starcitygames.com/pop.php?name=Consecrated+Sphinx’ target=’_new’>
<img src=’http://static.starcitygames.com/sales/cardscans/POPUPS/consecrated_sphinx.jpg’ border=’0′ alt=’Consecrated+Sphinx’ /><br />
<br />
<img src=’http://static.starcitygames.com/www/images/banners/media/mouseover/buy-this-card.jpg’ width=’182′ height=’33’ border=’0′ alt=’Buy This Card!’>
</a>
</div>”[/code]

But when I click on view element I see this code:

[code=html]<a class=”card_popup” href=”http://sales.starcitygames.com/cardsearch.php?game_type=1&amp;singlesearch=Acidic+Slime” rel=”
&lt;div style=’text-align: center; height: 360px; padding: 2px’&gt;
&lt;a href=’http://sales.starcitygames.com/pop.php?name=Acidic+Slime’ target=’_new’&gt;
&lt;img src=’http://static.starcitygames.com/sales/cardscans/POPUPS/acidic_slime.jpg’ border=’0′ alt=’Acidic+Slime’ /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;img src=’http://static.starcitygames.com/www/images/banners/media/mouseover/buy-this-card.jpg’ width=’182′ height=’33’ border=’0′ alt=’Buy This Card!’&gt;
&lt;/a&gt;
&lt;/div&gt;” tooltip=”Acidic%2BSlime”>Acidic Slime</a>[/code]

I’m downloading the website using this code in objective c:

[CODE]ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDefaultResponseEncoding:NSUTF8StringEncoding];
[request startSynchronous];
NSError *error = [request error];
storyHTML = [request responseString];[/CODE]

But for some reason I keep getting the HTML with the actual brackets >. I want to download the code that has the &lt;/div&gt; characters.

Any ideas??

Thanks!

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@iansane6Sep 02.2011 — Maybe a difference in browser and tool used? I'm using chrome and developer tools and when I use the right click vew element I get straight html without the character codes for the ampersands and spaces and stuff. I get straight html code.

Are you developing something in c that needs to be able to get the code rather than manually selecting and copy/pasting it?
Copy linkTweet thisAlerts:
@itgiawaauthorSep 03.2011 — yeah, I'm writing something in c that needs the version with the &s and stuff. Presumably thats the most original version....
Copy linkTweet thisAlerts:
@iansane6Sep 03.2011 — Well, looks like this is gonna get complicated. Unfortunately I don't know anything about objective c. I did find this which might be a starting point.

http://www.bartclaessens.com/2010/06/encoding-html-entities-in-objective-c/

I found that php has a built in function here.

http://php.net/manual/en/function.htmlentities.php

So it's looking to me like you have to download the code and parse through it to see if it already has encoded html characters and encode the characters, if not.

For example the function in php converts any character that has a html entity equivalent.

I'm wondering how this is affected by pages that follow good coding practice and separate display info from the data by using CSS. In that case the only html entities that might exist would be special characters that can't be found on the keyboard as regular text. In other words the & would just be an & with css styling and no '&amp;' and no encoded spaces or new lines right? I don't know.
×

Success!

Help @itgiawa 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,
)...