# Having trouble making an http connection

**URL:** <https://forum.developer.roku.com/t/having-trouble-making-an-http-connection/1940>\
**Category:** Archived\
**Tags:** roku-developer-program\
**Created:** [April 29, 2012, 3:32pm UTC](https://forum.developer.roku.com/t/having-trouble-making-an-http-connection/1940 "2012-04-29T15:32:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmsilva](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@lmsilva](https://forum.developer.roku.com/u/lmsilva)\
**Post date:** [April 29, 2012, 3:32pm UTC](https://forum.developer.roku.com/t/having-trouble-making-an-http-connection/1940/1 "2012-04-29T15:32:23Z")

</div>

Dear all,

I’m playing around with the sample code in the SDK and I’m trying to capture the “up” key in the custom video player example, sending the event to a php script I have and displaying it in the screen:  
'If the key is pressed, jump out of this context:  
else if msg.isRemoteKeyPressed()  
index = msg.GetIndex()  
print "Remote button pressed: " + index.tostr()  
m.help = "Remote button pressed: " + index.tostr()  
if index = 2 '  
url = “[http://192.168.1.217/myscript.php?keypress=](http://192.168.1.217/myscript.php?keypress=)” + index  
m.help = m.help + “You pressed up! This is where we would capture your vote! ;o)”  
xfer = CreateObject(“roURLTransfer”)  
xfer.SetURL(“[http://192.168.1.217/myscript.php?keypress=](http://192.168.1.217/myscript.php?keypress=)” + xfer.Escape(index))  
response = xfer.GetToString()  
m.help = m.help + response  
m.setup()  
else if index = 3 ' (toggle fullscreen)  
…

Any idea why my box hangs when I do this?  
I also tried copying the urlUtils.brs from another sample and using:  
http = NewHttp(“[http://192.168.1.217/myscript.php?keypress=](http://192.168.1.217/myscript.php?keypress=)” + xfer.Escape(index))  
rsp = http.GetToStringWithRetry()

But that also hangs my Roku…

Any thoughts?

p.s. on an unrelated matter, is BrightScript CaseSenSitive?

Thanks,  
Luis

---

<div class="post-metadata">

**Author:** ![destruk](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@destruk](https://forum.developer.roku.com/u/destruk)\
**Post date:** [April 29, 2012, 4:42pm UTC](https://forum.developer.roku.com/t/having-trouble-making-an-http-connection/1940/2 "2012-04-29T16:42:14Z")

</div>

What does the debugger say? What happens when you try to pull the page request in a browser? And it’s possible that the script is adding an http://, so try removing yours in your string.

---

<div class="post-metadata">

**Author:** ![belltown](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@belltown](https://forum.developer.roku.com/u/belltown)\
**Post date:** [April 29, 2012, 10:43pm UTC](https://forum.developer.roku.com/t/having-trouble-making-an-http-connection/1940/3 "2012-04-29T22:43:48Z")

</div>

I see a couple of places where you’re using ‘index’ (an Integer) where a String is expected:

```auto
url = "http://192.168.1.217/myscript.php?keypress=" + index

```

and

```auto
xfer.SetURL("http://192.168.1.217/myscript.php?keypress=" + xfer.Escape(index))

```

You might want to try using index.ToStr() instead.

---

<div class="post-metadata">

**Author:** ![lmsilva](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@lmsilva](https://forum.developer.roku.com/u/lmsilva)\
**Post date:** [April 30, 2012, 1:49am UTC](https://forum.developer.roku.com/t/having-trouble-making-an-http-connection/1940/4 "2012-04-30T01:49:40Z")

</div>

Ah, that worked! Thanks guys!!!
