Page 1 of 1

maximum length of include string...

Posted: Tue Jun 22, 2004 2:33 pm
by batfastad
Hello,

Is there a maximum length of the file address that can be included in a page?

I'm using include() to include a remote file, but the address of the remote file is about 150 characters in total.

It works fine when I shorten this to about 60, but for technical reasons the file address has to be this long.
The reason is it's a manual request to our database system and so consists of lots of &sort=ascend&field1=name&field2=postcode
etc...

Is there a maximum length of the string that can be used in the include function?

I've tried splitting the string up into more variables, then just concatenating them in the include() function but it still doesn't work - which makes me think there must be a limit on the function.

Anyone found a workaround for this?

Thanks in advance.

Posted: Tue Jun 22, 2004 2:55 pm
by infolock
to my knowledge, there is not a maximum length that can be passed.

Edit : maybe you forgot a '&' or 2 ... happens all the time

Posted: Tue Jun 22, 2004 2:57 pm
by feyd
you may want to try using [php_man]curl[/php_man]

Posted: Tue Jun 22, 2004 3:07 pm
by batfastad
Unfortunately there's nothing I can do with curl as this is on our external hosted webspace.

The code I've got is...

Code: Select all

<?php
$cdmlrequest = "FMPro?-DB=F1RESULTS&-Format=f1.html&-Lay=FRONT&-SortField=DRIVER TOTAL&-SortOrder=descend&-Token.0=REAL&-FindAll";

include("http://www.domain.com/".$cdmlrequest);
?>
And I get a Failed to Open error.

Though if I remove...

Code: Select all

&amp;-Lay=FRONT&amp;-SortField=DRIVER TOTAL&amp;-SortOrder=descend&amp;-Token.0=REAL
...from $cdmlrequest it seems to work fine. I've tried permutations of the code, playing around with which bits of the string are present to see if it's something to do with that, but there definitely seems to be a character number threshold where it's breaking.

Posted: Tue Jun 22, 2004 3:10 pm
by feyd
try changing DRIVER TOTAL to DRIVER%20TOTAL

Posted: Tue Jun 22, 2004 3:11 pm
by feyd
batfastard, you seem to have "Notify me of replies" turned on.. please turn it off.

Posted: Tue Jun 22, 2004 3:19 pm
by batfastad
Now it works!!

Excellent.
Thanks for pointing that out.

I didn't realise I had to put the URL encoded format in the variables, but I guess I should have worked it out!
Having to type a URL into the include function and everything.

Thanks for your help!!

PS: I didn't realise there was a problem with 'notify me when a reply is posted'.
Is that better? I've turned it off for this one.

Posted: Tue Jun 22, 2004 3:20 pm
by feyd
testing if it works now..

[edit]yep that fixed it.. Now we know it's broken right now.