ohdang888 Posted April 20, 2009 Share Posted April 20, 2009 i'm passing html via the url... so i have something like this: <?php $code = "<center> blah blah blah"; $code = urlencode($code); echo "<a href='index.php?code=".$code."'>Go</a> "; ?> and on index.php i store urldecode($_GET['code']); in a databse it works fine, but i found a really weird error. After long trail and error and testing strlen($code), i discovered that the process only works if the $code is 512 characters or less. After that, it doesn't work. it doesn't store ANYTHING in the database. No errors, everything says its working, but its not. Once it gets to 513 characters or more, just stops. My table field i'm inserting it into is a LONGTEXT, which can store 4 trillion bytes, so that's obviously not the issue. Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/ Share on other sites More sharing options...
teynon Posted April 20, 2009 Share Posted April 20, 2009 URL's can only store up to 2083 characters. Your going to have to use POST or sessions for more data. Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814234 Share on other sites More sharing options...
ohdang888 Posted April 20, 2009 Author Share Posted April 20, 2009 hmmmmmmmm i'm slightly confused as to how to do this then.... I'm building a simple application platform. The app has to pass html to me, and i'm using: simplexml_load_file($api_url.$string); Facebook platform has a similar function that passes sometimes large amounts of html to the api. How would this be done over post? I know i could use cURL, but then i don't get the quick xml set up from simplexml_load_file Thanks! Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814236 Share on other sites More sharing options...
teynon Posted April 20, 2009 Share Posted April 20, 2009 The code might be 500 some characters, but when converted with urlencode, plus the url thats already there, it probably extends past the urls limit. For POST: <form method="POST" action="Location.php"><input type="hidden" name="code" value="<?=$code;?>"><a href="index.php" onClick="form.submit();">Go</a></form> I don't remember if form.submit() will work or not because javascript is very useful but annoyingly hard to remember to me. If it doesn't work, just look up the submit function lol. Your recieving form will have to check the $_POST instead of $_GET Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814237 Share on other sites More sharing options...
ohdang888 Posted April 20, 2009 Author Share Posted April 20, 2009 but this isn't a form users fill out. its an object an a class that sends a request to my API file through get vars, which returns xml, which the apps parses. go its not a form, its more like this $api->updateHTML($code); any ideas? Thanks! Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814239 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 You could have hidden inputs and use javascript to auto submit the form once the page is loaded? Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814253 Share on other sites More sharing options...
ohdang888 Posted April 20, 2009 Author Share Posted April 20, 2009 well i currently block apps from using javascript so i would perfer another way if possible blah Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814911 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 Why? Javascript is awesome. Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814923 Share on other sites More sharing options...
soak Posted April 20, 2009 Share Posted April 20, 2009 Try this: http://netevil.org/blog/2006/nov/http-post-from-php-without-curl Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-814933 Share on other sites More sharing options...
ohdang888 Posted April 21, 2009 Author Share Posted April 21, 2009 Why? Javascript is awesome. because its awesome, but easy to f*** up my page with it if apps use it. I'm trying to figure out how facebook and opensocial do their javascript and css, but its way beyond my level (they add "app_'app_id' " infront of all ids and classes in the html of the app, and add the similar thing to all javscript and css. Its quote confusing to figure out how they do it ) I think i might just use cURL... Link to comment https://forums.phpfreaks.com/topic/154818-weirddddd/#findComment-815144 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.