<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Access FA from curl/wget]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=3629&amp;type=atom" />
	<updated>2017-11-11T19:31:43Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=3629</id>
		<entry>
			<title type="html"><![CDATA[Re: Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29565#p29565" />
			<content type="html"><![CDATA[<p>FA 2.4.x now has a few hidden fields in the login form apart from the ones listed in @elax previous post:<br /></p><div class="codebox"><pre><code>&lt;input id=&quot;ui_mode&quot; name=&quot;ui_mode&quot; value=&quot;1&quot; type=&quot;hidden&quot;&gt;
..
..
&lt;input name=&quot;_focus&quot; value=&quot;user_name_entry_field&quot; type=&quot;hidden&quot;&gt;
&lt;input name=&quot;_modified&quot; value=&quot;0&quot; type=&quot;hidden&quot;&gt;
&lt;input name=&quot;_confirmed&quot; value=&quot;&quot; type=&quot;hidden&quot;&gt;
&lt;input name=&quot;_token&quot; value=&quot;iwyLHJUcoMkfRv8-ZpBQVwxx&quot; type=&quot;hidden&quot;&gt;</code></pre></div><p>The <strong>_token</strong> field will come up on calling the login form and must be parsed out and submitted with the field values in cURL.<br /></p><div class="codebox"><pre><code>TOKENCODE=`curl -c my_session http://localhost/frontac24/ | sed -ne &#039;/name=&quot;_token&quot;/s/.*value=&quot;\([^&quot;]*\)&quot;.*/\1/p&#039;`</code></pre></div><p>The following would log you in where your admin user&#039;s password is &quot;secret&quot;:<br /></p><div class="codebox"><pre><code>curl -c my_session \
      -F &#039;user_name_entry_field=admin&#039; \
      -F &#039;password=secret&#039; \
      -F &#039;company_login_name=1&#039; \
      -F &#039;ui_mode=1&#039; \
      -F &#039;modified=0&#039; \
      -F &#039;confirmed=1&#039; \
      -F &quot;_token=${TOKENCODE}&quot; \
      -F &#039;_focus=user_name_entry_field&#039;  \
      http://localhost/frontac24/ &gt; logged_in_page.txt</code></pre></div><p>The file &quot;logged_in_page.txt&quot; will contain the html code for the FA&#039;s logged in page.</p><p>To study the parameters required for the Sales Summary Report:<br /></p><div class="codebox"><pre><code>curl -b my_session \
     -F &#039;Class=0&#039; \
     -F &#039;REP_ID=114&#039; \
     http://localhost/frontac24/reporting/reports_main.php &gt; report_form.txt</code></pre></div><p>To get the Sales Summary Report:<br /></p><div class="codebox"><pre><code>curl -b my_session \
     -F &#039;REP_ID=114&#039; \
     -F &#039;PARAM_0=01/01/2015&#039; \
     -F &#039;PARAM_1=10/31/2017&#039; \
     -F &#039;PARAM_2=0&#039; \
     -F &#039;PARAM_3=AutoSalesSummaryReport&#039; \
     -F &#039;PARAM_4=0&#039; \
     -F &#039;PARAM_5=0&#039; \
     -F &#039;Class=0&#039; \
     http://localhost/frontac24/reporting/rep114.php &gt; Sales_Summary_Report.pdf</code></pre></div><p>Now to logout:<br /></p><div class="codebox"><pre><code>curl -b my_session http://localhost/frontac24/access/logout.php? &gt; logged_out_page.txt</code></pre></div><p>The &quot;logged_out_page.txt&quot; will contain the html code for the logged out page.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-11T19:31:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29565#p29565</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14616#p14616" />
			<content type="html"><![CDATA[<p>Wiki stands updated. Thanks elax.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2012-12-13T10:18:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14616#p14616</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14613#p14613" />
			<content type="html"><![CDATA[<p>Thanks apmuthu. Just be aware that price_list.csv is not part of front accounting (yet?) but it&#039;s an example of a report returning a CSV. You might be able to download that way a proper FA report by setting the appropriate parameters specific to the report, but I haven&#039;t tried it.</p><p>/Elax</p>]]></content>
			<author>
				<name><![CDATA[elax]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=6206</uri>
			</author>
			<updated>2012-12-13T09:47:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14613#p14613</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14594#p14594" />
			<content type="html"><![CDATA[<p>Thanks <strong>#elax</strong>.</p><p><a href="https://frontaccounting.com/fawiki/index.php?n=Devel.ManualCURLInFA">Wiki</a>ied it with source for field names taken from <strong>access/login.php</strong>.</p><p>This is a nice tute for cURL usage from the CLI !</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2012-12-13T03:41:24Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14594#p14594</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14552#p14552" />
			<content type="html"><![CDATA[<p>My mistake, is `user_name_entry_field` not `user_name_entry`.</p>]]></content>
			<author>
				<name><![CDATA[elax]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=6206</uri>
			</author>
			<updated>2012-12-07T16:06:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14552#p14552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14551#p14551" />
			<content type="html"><![CDATA[<p>found it:</p><div class="codebox"><pre><code>curl -F &#039;user_name_entry=&lt;username&gt;&#039; -F &#039;password=&lt;password&gt;&#039; -F &#039;company_login_name=&lt;company number&gt;&#039; url</code></pre></div><p>This allow to log at every request.<br />Too keep a session alive (easier for manual request) use, the -c and -b option of curl.<br /></p><div class="codebox"><pre><code> curl -c my_session -F &#039;user_name_entry=&lt;username&gt;&#039; -F &#039;password=&lt;password&gt;&#039; -F &#039;company_login_name=&lt;company number&gt;&#039; url </code></pre></div><p>for the first time<br />then<br /></p><div class="codebox"><pre><code> curl -b my_session url</code></pre></div><p>(reuse the cookie stored in my_session.</p>]]></content>
			<author>
				<name><![CDATA[elax]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=6206</uri>
			</author>
			<updated>2012-12-07T14:53:51Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14551#p14551</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Access FA from curl/wget]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14549#p14549" />
			<content type="html"><![CDATA[<p>Hi</p><p>I need to add to FA some pages which I want to access not from a Web browser but from curl/wget.<br />Those pages are some kind of report which I probably could do in pure SQL but that would be safer to the php code from FA.<br />For example&nbsp; I need a csv with a price list, and ideally I would go something line<br />&nbsp; &nbsp;<br /> </p><div class="codebox"><pre><code>wget www.fa.com/price_list.csv</code></pre></div><p>The problem is I need to create a session or something. Is there a to &quot;disable&quot; session for certain page (I don&#039;t really care about security, I would even be happy to just do <br /></p><div class="codebox"><pre><code>php price_list.csv.php &gt; price_list.csv</code></pre></div><p> from the current on FA directory (on the localhost)</p><p>But I have still this problem of session.<br />So the question, how can I write a php page which can include all FA db settings, and access to its functions, without having to use session (or is there a way to emulate this session somehow)</p><p>/Elax</p>]]></content>
			<author>
				<name><![CDATA[elax]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=6206</uri>
			</author>
			<updated>2012-12-07T12:15:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14549#p14549</id>
		</entry>
</feed>
