# Pull information from URL

**URL:** https://forum.kirupa.com/t/pull-information-from-url/58908
**Category:** flash
**Created:** [July 26, 2004, 11:36pm UTC](https://forum.kirupa.com/t/pull-information-from-url/58908 "2004-07-26T23:36:04Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![The\_Vulcan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/the_vulcan/32/145_2.png) [@The\_Vulcan](https://forum.kirupa.com/u/The_Vulcan)
#### Post date: [July 26, 2004, 11:36pm UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/1 "2004-07-26T23:36:04Z")

</div>

I need to pull

[color=#003399]id = 99;[/color]  
[color=#003399]code = d02d;[/color]  
[color=#003399]pass = 32422;[/color]  
[color=#003399]user = bob;[/color]  
[color=#003399][/color]  
[color=#003399]info from a url ie:[/color]  
[color=#003399][/color]  
[[color=blue]http://www.mydomain.com/guestbook.html?id=99&code=d02d&pass=32422&&user=bob[/color]](http://www.mydomain.com/guestbook.html?id=99&code=d02d&pass=32422&&user=bob)  
[color=#003399][/color]  
[color=#003399][/color]  
[color=#003399]I would imagine pulling it into a array and cutting it up, however thats beyond me.[/color]  
[color=#003399][/color]  
[color=#003399]If anyone could help with this, or point me towards a snipt of code I could modify it would be much appreciated.[/color]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 12:27am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/2 "2004-07-27T00:27:22Z")

</div>

To my knowledge, you would have to use javascript to deliver that info into flash, because I don’t think that flash has any way to check the URL for variables.

You can also have a php script write a text file and load that, etc. etc., there are some workarounds.

Read this,

[http://www.macromedia.com/support/flash/ts/documents/set\_variables.htm](http://www.macromedia.com/support/flash/ts/documents/set_variables.htm)

–EP

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 12:57am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/3 "2004-07-27T00:57:02Z")

</div>

Thanks for that…

The php script ?

if I load a .php file I can get the URL easy enough using

$userid = $\_REQUEST[‘id’];

Problem is I can’t pass that to flash from the .php  
If I try to print that the out put goes to the browser and not passed to Flash.

Is there a PHP command that will get the current URL of a HTML page you are on ?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:09am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/4 "2004-07-27T01:09:07Z")

</div>

I don’t agree with what was said ealier, I think they are automatically avialable inside flashes root, just refer to user or whatever variable and it automatically returns the variable 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:18am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/5 "2004-07-27T01:18:40Z")

</div>

Hmmmm ya lost me bombing

As for this

> I don’t think that flash has any way to check the URL for variables.

It would have to be cut up and put into and array, and then pull out each bit and assign it to a var.

However that is beyond me… and from what I can tell Flash will only return the URL to the Flash .swf NOT the url in the address bar. ☹

There must be a way to call on PHP from a HTML page to grab the current URL in the address bar…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:28am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/6 "2004-07-27T01:28:16Z")

</div>

# this is the code to parse:

# mystring = “[http://www.somesite.com?var1=testing&var2=again](http://www.somesite.com?var1=testing&var2=again)”; myLoadVars = new LoadVars(); myLoadVars.decode(mystring); for(j in myLoadVars){ trace(myLoadVars[j]); }

you can adapt that if you can get bombingpixels idea to work, but I have never heard of how to access url variables in \_root. If anybody knows how that is done, please let us know.

–EP

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:40am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/7 "2004-07-27T01:40:47Z")

</div>

```php
absolutePath = _root._url;
splitPath = absolutePath.split("/");
splitPath.pop();
folder = splitPath[splitPath.length-1];

```

Thats some code I was given a few months ago… however that will only return the URL of the .swf

hence this may be in the address bar  
[http://www.mydomain.com/guestbook.html?id=99&code=d02d&pass=32422&&user=bob](http://www.mydomain.com/guestbook.html?id=99&code=d02d&pass=32422&&user=bob)

but it will only return  
[http://www.mydomain.com/guestbook.swf](http://www.mydomain.com/guestbook.swf)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:58am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/8 "2004-07-27T01:58:59Z")

</div>

I found this… so I am going to see if I can get it to work…

Write a action in your Flash Movie such as :

> getURL(“javascript:getHTMLURL();”);

and in the HTML Page in which this Flash Movie is emebed write a Javascript function such as:

function getHTMLURL()  
{  
alert("HTML URL is : " + document.URL);  
}

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:13am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/9 "2004-07-27T03:13:12Z")

</div>

just try tracing(userid) in your file, let me make you an example real fast…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:14am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/10 "2004-07-27T03:14:26Z")

</div>

[http://bombingpixels.com/bombingpixels/url\_function.swf?id=30](http://bombingpixels.com/bombingpixels/url_function.swf?id=30)

my only code is: test.text=id;

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:27am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/11 "2004-07-27T03:27:54Z")

</div>

So how are you getting id=30 into flash ?

Right now I am working on some java script…

```php
function doPassVar(args){
	var sendText = args.value;
	window.document.myFlash.SetVariable("myVar", sendText);
}
function getHTMLURL(){
     alert("HTML URL is : " + document.URL);
}

```

I was just trying to work out how to combine those to functions, which would pass the entire URL to flash… I would then still have to break it up…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:31am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/12 "2004-07-27T03:31:37Z")

</div>

You did it but I dont know how…

I tried entering a different number other than 30 and it worked…

Do tell 😃

I have spent the last 3-4 hours searching google, I had just found you can pass variables with java and so was looking into that.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:35am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/13 "2004-07-27T03:35:12Z")

</div>

I told you, just make a textfield with the name test and put in the code 😉

I mean the code that I gave you above, the one that looked like: test.text=id;

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:41am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/14 "2004-07-27T03:41:06Z")

</div>

I did that…

But I tried it in the .html file I had…

it needs to be the .swf in the URL

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:43am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/15 "2004-07-27T03:43:50Z")

</div>

Sweet… once again something so simple has me going around in circles…

If you keep saving me I am gonna have to put you on the pay roll 😃

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:44am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/16 "2004-07-27T03:44:31Z")

</div>

what do you mean? when you call the swf from the html it no longer works?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:52am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/17 "2004-07-27T03:52:09Z")

</div>

Nope it doesn’t work from the html…

Which is killing me now cause that means I have no control over size…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:52am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/18 "2004-07-27T03:52:19Z")

</div>

[http://bombingpixels.com/bombingpixels/url\_function.html](http://bombingpixels.com/bombingpixels/url_function.html)

look at the source code, iit uses the same fla, you can change it to .fla to see the fla too, everything’s uploaded 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 3:58am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/19 "2004-07-27T03:58:59Z")

</div>

Where is 5214

I see its not in the .fla

but it is not in the url either ?  
[http://nokrev.no-ip.com/bombingpixels/url\_function.html](http://nokrev.no-ip.com/bombingpixels/url_function.html)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 4:02am UTC](https://forum.kirupa.com/t/pull-information-from-url/58908/20 "2004-07-27T04:02:53Z")

</div>

I see where you have it… but that wont help me there…

It will be coming from a e-mail account vailidation…

I wont know what the:  
id  
code (md5 encryption)  
username  
password

is… ☹

Looks like its back to the Java function… and then the dam split()

OOP’s… lucky I posted the Java, I closed the file I was working on and didn’t save it… and I would hate to try and find it again… About time I got lucky 🙂

[Next page](https://forum.kirupa.com/t/pull-information-from-url/58908.md?page=2)
