Jump to content

[Urgent!] Possible to obtain page's HTML of dynamically added text?


B0b

Recommended Posts

Hi guys,

 

I must know if there's any way to obtain the page HTML after some content has been dynamically added via Javascript (AJAX).

For example, the description of an item on eBay doesn't appear in the source code of the page... is there anyway to still grab the page HTML with the description (curl_setopt)?

 

Thank you very much.

I think you have to know where the html came from, from the ajax...

 

For example you view:

http://ebay.com/somepage

 

and the ajax comes from:

http://ebay.com/anotherpage

 

you would have to get the html from there.

 

I am not sure, but that is my BEST guess

I guess you would need a javascript parser for that. But going along the lines of The Little Guy's post, I found out that the eBay descriptions are retrieved from

 

http://vi.ebaydesc.com/ws/eBayISAPI.dll?ViewItemDescV4&item=ID

 

where ID is the item ID. So starting out with a sample URL like

 

http://cgi.ebay.com/ASKSOS-ROMAN-EGYPTIAN-FRAGMENTARY-1600-YEARS-OLD-NR_W0QQitemZ380163697044QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item588385a994&_trksid=p3286.c0.m14

 

we can grab the item ID directly from the URL and then get the description. eBay uses their own query string syntax, with QQ instead of &, and Z instead of =, in case you didn't notice.

 

<?php
$url = 'http://cgi.ebay.com/ASKSOS-ROMAN-EGYPTIAN-FRAGMENTARY-1600-YEARS-OLD-NR_W0QQitemZ380163697044QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item588385a994&_trksid=p3286.c0.m14';
preg_match('~QQitemZ([0-9]+)QQ~', $url, $match);
$desc_url = "http://vi.ebaydesc.com/ws/eBayISAPI.dll?ViewItemDescV4&item={$match[1]}";
?>

thebadbad << the only reason that done so general wannabe hackers don't do what you just shown them to do so easily.

 

got to be very careful what you show people on phpfreaks even Theo there no harm caused.

 

i hope ebay is more security minded then that are they?.

thebadbad << the only reason that done so general wannabe hackers don't do what you just shown them to do so easily.

 

got to be very careful what you show people on phpfreaks even Theo there no harm caused.

 

i hope ebay is more security minded then that are they?.

 

I'm pretty sure that's not the only reason they're doing it. And it's not like I'm revealing some dark secrets of hacking; the data is publicly available (not necessarily meaning that you're free to do anything with it though). But if they offer an API like jon23d mentions, you might as well just use that instead. That is if the OP actually wanted to grab the data from eBay, and not just mentioned it as a pure example.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.