Problems passing arguments in <href> element under a network link

269 views
Skip to first unread message

Tallywag

unread,
May 17, 2008, 1:18:25 PM5/17/08
to KML Developer Support - KML Server Side Scripting
Ok first post for help on KML everything up to this point has been
pretty straightforward !

I want to pass two arguments to my writeKML.php script from a network
link .KML file however all my attempts to do have failed.

<NetworkLink>
<Link>
<href>http://www...../writeKML.php?arga=A-
BCDE&argb=2008-04-16</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>300</refreshInterval>
</Link>
</NetworkLink>

When I tried the above but I got the "not well formed (invalid token)"
error message on loading the network link KML file.

URLencoding the above <href> line to....

<NetworkLink>
<Link>
<href>http%3A%2F%2Fwww.....%2FwriteKML.php%3Farga%3DA-BCDE
%26argb%3D2008-04-16</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>300</refreshInterval>
</Link>
</NetworkLink>

removes the error message and GE loads OK but I get the broken network
link icon (red dot)

If I hard code the arguments into the writeXML.php and remove the
arguments from the <href> element in the network link KML file
everything works fine.
That is ...

In writeXML.php ...
$arga = 'A-BCDE';
$argb = '2008-04-16'

In my network link KML file...
<NetworkLink>
<Link>
<href>http://www...../writeKML.php</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>300</refreshInterval>
</Link>
</NetworkLink>

So the question is how can I pass arguments to a php script in a
network link?

I hope I have made my requirments/problems clear !!!


KoflAIR

unread,
May 18, 2008, 10:46:29 AM5/18/08
to KML Developer Support - KML Server Side Scripting
>         <href>http://www...../writeKML.php?arga=A-
> BCDE&argb=2008-04-16</href>

Try replacing the & sign in your URL by &amp;

ManoM

unread,
May 18, 2008, 1:46:06 PM5/18/08
to KML Developer Support - KML Server Side Scripting
Hi Tallywag,

As KoflAIR suggested, you can escape it using &amp;
http://code.google.com/apis/kml/documentation/kmlreference.html#httpquery
You can also use the <httpQuery> element:
<NetworkLink>
<Link>
<href>http://www...../writeKML.php</href>
<httpQuery>arga=ABCDE;argb=2008-04-16</httpQuery>
<refreshMode>onInterval</refreshMode>
<refreshInterval>300</refreshInterval>
</Link>
</NetworkLink>

http://code.google.com/apis/kml/documentation/kmlreference.html#httpquery

Mano

Tallywag

unread,
May 22, 2008, 8:06:27 AM5/22/08
to KML Developer Support - KML Server Side Scripting
Thanks Guys....
I could have saved myself hours of trying different thing by asking
here first ;o)


On May 18, 6:46 pm, ManoM wrote:
> Hi Tallywag,
>
> As KoflAIR suggested, you can escape it using &amp;http://code.google.com/apis/kml/documentation/kmlreference.html#httpq...
> You can also use the <httpQuery> element:
>      <NetworkLink>
>        <Link>
>          <href>http://www...../writeKML.php</href>
>          <httpQuery>arga=ABCDE;argb=2008-04-16</httpQuery>
>          <refreshMode>onInterval</refreshMode>
>          <refreshInterval>300</refreshInterval>
>        </Link>
>      </NetworkLink>
>
> http://code.google.com/apis/kml/documentation/kmlreference.html#httpq...
> > I hope I have made my requirments/problems clear !!!- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages