Skip to content

Instantly share code, notes, and snippets.

@tdurieux
Created August 7, 2014 21:03
Show Gist options
  • Save tdurieux/d741c7af5d27c4df4943 to your computer and use it in GitHub Desktop.
Save tdurieux/d741c7af5d27c4df4943 to your computer and use it in GitHub Desktop.
HTML pages that need post data
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Christian Heilmann</author>
<description>HTML pages that need post data</description>
<sampleQuery><![CDATA[
select * from {table} where
url='http://isithackday.com/hacks/htmlpost/index.php'
and postdata="foo=foo&bar=bar" and xpath="//p"]]></sampleQuery>
<documentationURL></documentationURL>
</meta>
<bindings>
<select itemPath="" produces="XML">
<urls>
<url>{url}</url>
</urls>
<inputs>
<key id="url" type="xs:string" required="true" paramType="variable"/>
<key id="postdata" type="xs:string" required="true" paramType="variable"/>
<key id="cookies" type="xs:string" required="false" paramType="variable"/>
</inputs>
<execute>
<![CDATA[
var myRequest = y.rest(url);
var data = myRequest.accept('text/xml').forceCharset('UTF-8').header("Cookie",cookies).
contentType("application/x-www-form-urlencoded").
post(postdata);
var cook = y.jsonToXml(data.headers);
response.object = <response><body>{data.response}</body><headers>{cook}</headers></response>;
]]>
</execute>
</select>
</bindings>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment