# httpGet

**URL:** <https://forum.inductiveautomation.com/t/httpget/1553>\
**Category:** Ignition\
**Created:** [February 19, 2010, 2:08pm UTC](https://forum.inductiveautomation.com/t/httpget/1553 "2010-02-19T14:08:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_mccutchen](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@david\_mccutchen](https://forum.inductiveautomation.com/u/david_mccutchen)\
**Post date:** [February 19, 2010, 2:08pm UTC](https://forum.inductiveautomation.com/t/httpget/1553/1 "2010-02-19T14:08:07Z")

</div>

In FPMI I have the following code which works well. It gives an I/O error in Ignition.

[code]#screen scrape from the gateway to get a list of the FactoryPMI datasources  
if event.propertyName == “ListInit”:  
address = system.util.getGatewayAddress()  
source = system.net.httpGet(“http://%s/gateway/Gateway?tab=datasources” % address)  
findStr = “Datasource '`”
endFindStr = “`’”

```
Headers = ["DataSource"]
Names = []
pos = source.find(findStr)
while pos != -1:
	pos2 = source.find(endFindStr)
	#save it to a dataset
	print source[pos+18:pos2]
	Names.append([source[pos+18:pos2]])
	source = source[pos2+8:]
	pos = source.find(findStr)

event.source.data = system.dataset.toDataSet(Headers, Names)[/code]

```

Error:

[code]Traceback (innermost last):  
File “event:propertyChange”, line 4, in ?  
IOError: http

```
at org.python.core.Py.IOError(Py.java)
at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.httpGet(AbstractNetUtilities.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:286)
at org.python.core.PyObject. __call__ (PyObject.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx61.f$0(<event:propertyChange>:4)
at org.python.pycode._pyx61.call_function(<event:propertyChange>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:367)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:138)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:280)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at $Proxy1.propertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.awt.Component.firePropertyChange(Unknown Source)
at com.inductiveautomation.factorypmi.application.components.PMIComboBox.fireDynChange(PMIComboBox.java:872)
at com.inductiveautomation.factorypmi.application.binding.util.DynamicPropertyUtil.setPropertyValue(DynamicPropertyUtil.java:217)
at com.inductiveautomation.factorypmi.application.components.PMIComboBox.setPropertyValue(PMIComboBox.java:860)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateTarget(AbstractPropertyAdapter.java:111)
at com.inductiveautomation.factorypmi.application.binding.SQLPropertyAdapter.propertyChange(SQLPropertyAdapter.java:208)
at com.inductiveautomation.factorypmi.application.gateway.QueryManager$PropertyChangeUpdater.run(QueryManager.java:501)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

```

Ignition v7.0.2 (b4482)  
Java: Sun Microsystems Inc. 1.6.0\_18  
[/code]

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 19, 2010, 6:23pm UTC](https://forum.inductiveautomation.com/t/httpget/1553/2 "2010-02-19T18:23:02Z")

</div>

Looks like you’re porting over a Click-to-chart setup.

There are a few things going on here. None of them have to do with the httpGet function.

1. system.util.getGatewayAddress() returns a different format than in FactoryPMI. Notably, it returns the “http://” directly, so the address you’re feeding httpGet is like “[http://http](http://http)://192.168…(etc)”

2. Even after you fixed that, it wouldn’t work. This method is “screen-scraping” the gateway webpage to get a list of all datasources. The Gateway’s web interface has changed a bit (to put it mildly) from FactoryPMI to Ignition - this will no longer work.

3. Because of exactly this problem, 7.0.3 which is coming out later today has a system.db.getConnections() function.

---

<div class="post-metadata">

**Author:** ![david\_mccutchen](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@david\_mccutchen](https://forum.inductiveautomation.com/u/david_mccutchen)\
**Post date:** [February 22, 2010, 12:35pm UTC](https://forum.inductiveautomation.com/t/httpget/1553/3 "2010-02-22T12:35:47Z")

</div>

I went ahead and change this to a query to get the info I needed.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 22, 2010, 7:11pm UTC](https://forum.inductiveautomation.com/t/httpget/1553/4 "2010-02-22T19:11:33Z")

</div>

Ok, you might want to change it to use the getConnections() call, because we don’t guarantee screen-scraping backwards compatibility.
