maximum length of include string...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

maximum length of include string...

Post 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.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post 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
Last edited by infolock on Tue Jun 22, 2004 3:02 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you may want to try using [php_man]curl[/php_man]
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try changing DRIVER TOTAL to DRIVER%20TOTAL
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

batfastard, you seem to have "Notify me of replies" turned on.. please turn it off.
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

testing if it works now..

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