Sign in to follow this  

[web] Form Method Get With Out ? Needed

This topic is 4091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to figure out Mapquest maps on my blog due to me hosting several parties this month. Now everything works fine except when I try to include the url for the mapquest map image the blog deletes that image tag. I finally traced it down and it seems like it has a problem with the ? in the url due to the image using a Form Get Method. I know I could save the image else where and then upload it and other stuff. But now its bugging me to know that this is happening and Im guessing there must be someway around it using php. I was planning on using the Get Method for images on this same blog for other reasons using php so I guess indirectly I found a problem I never thought of. I know in php your able to change the arg_separator.output to a ; instead of an & to seperate your form values. So Does anyone know how I could accomplish this or someway to use the Form Get Method without there being an question mark? PS Im aware that I could just as easy upload a picture on a imagehosting server or give the direct URL instead of using the Form Get Method to sepecify the image but I just want to see if it is possible.

Share this post


Link to post
Share on other sites
You can't change the way GET works - it's a fundamental part of HTTP that starts with a '?' and separates subsequent fields with '&'. The problem is in your blog software. Why is it chewing up perfectly good URLs? Perhaps you're not encoding your ampersands as '&' the way you're supposed to?

Share this post


Link to post
Share on other sites
LONG WAY:

If you are using Apache 2 and AcceptPathInfo = On in httpd.conf, then you can do something like create another page to do this work for you... say "translate.php" to translate PATH_INFO (any string after the filename in the requested URL) to a GET request in this way:

translate.php:

<?php

/*
Consider for example you link to:
translate.php/imagefile.php/foo=bar&this=that&cheese=mmm
*/


$pathinfo = substr( $_SERVER['PATH_INFO'], 1 ); // Take away the leading slash
$target = explode( '/', $pathinfo, 2 ); // Separate remaining into a 2 part array

$file = $target[0]; // imagefile.php
$query = $target[1]; // foo=bar&this=that&cheese=mmm

$url = $file . '?' . $query; // imagefile.php?foo=bar&this=that&cheese=mmm

// Redirect
header( "Location: " . $url );

?>


So now to access "imagefile.php?foo=bar&this=that&cheese=mmm", you will link your image to "translate.php/imagefile.php/foo=bar&this=that&cheese=mmm"

I know this is really a complex way but i guess it is one of your only limited solutions if you can't fix the blog script first.


Edit: If your blog script doesnt allow ampersands as well you can probably modify the above code to replace each & with another / and then explode() deeper but that's just taking it too far (not like this isn't already).

Share this post


Link to post
Share on other sites

This topic is 4091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this