#1 3. Juni 2011 Wikipedia Code Hallo alle zusammen, kennt wich wer mit wikipedia api aus? ich benutze folgenden code um die xml zu laden: Code: <?php ini_set('user_agent','whatever'); $xmlDoc = new DOMDocument(); $xmlDoc->load("http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Will_Smith&rvprop=content&format=xml"); print $xmlDoc->saveXML(); ?> nun dachte ich es gibt bestimmt schon sowas wie wikipedia xml reader??? Ich möchte den Inhalt des Artikels möglichst so haben wie in wikipedia selbst. MFG Aeonsam
#2 3. Juni 2011 AW: Wikipedia Code du hast damit den inhalt unformatiert in wikipedia-syntax. entweder du holst dir nen parser für diese syntax, oder du lässt die api weg und holst dir den inhalt über die normale webseite von wikipedia.
#3 4. Juni 2011 AW: Wikipedia Code MediaWiki API Code: * prop=revisions (rv) * Get revision information This module may be used in several ways: 1) Get data about a set of pages (last revision), by setting titles or pageids parameter 2) Get revisions for one given page, by using titles/pageids with start/end/limit params 3) Get data about a set of revisions by setting their IDs with revids parameter All parameters marked as (enum) may only be used with a single page (#2) This module requires read rights Parameters: rvprop - Which properties to get for each revision: ids - The ID of the revision flags - Revision flags (minor) timestamp - The timestamp of the revision user - User that made the revision userid - User id of revision creator size - Length of the revision comment - Comment by the user for revision parsedcomment - Parsed comment by the user for the revision content - Text of the revision tags - Tags for the revision Values (separate with '|'): ids, flags, timestamp, user, userid, size, comment, parsedcomment, content, tags, flagged Default: ids|timestamp|flags|comment|user rvlimit - Limit how many revisions will be returned (enum) No more than 500 (5000 for bots) allowed rvstartid - From which revision id to start enumeration (enum) rvendid - Stop revision enumeration on this revid (enum) rvstart - From which revision timestamp to start enumeration (enum) rvend - Enumerate up to this timestamp (enum) rvdir - Direction of enumeration - towards "newer" or "older" revisions (enum) One value: newer, older Default: older rvuser - Only include revisions made by user rvexcludeuser - Exclude revisions made by user rvtag - Only list revisions tagged with this tag rvexpandtemplates - Expand templates in revision content rvgeneratexml - Generate XML parse tree for revision content rvparse - Parse revision content. For performance reasons if this option is used, rvlimit is enforced to 1. rvsection - Only retrieve the content of this section number rvtoken - Which tokens to obtain for each revision Values (separate with '|'): rollback rvcontinue - When more results are available, use this to continue rvdiffto - Revision ID to diff each revision to. Use "prev", "next" and "cur" for the previous, next and current revision respectively rvdifftotext - Text to diff each revision to. Only diffs a limited number of revisions. Overrides rvdiffto. If rvsection is set, only that section will be diffed against this text