[PHP] Limitation to URL params on Include()?
Hi All, Is there a limit to the number of url parameters(other than the 256 limit) that you can have on a file that you are including? I have a file that I'm calling.., include('http://mydomain.com/block_display.php?id=1ttl=1011cnt=268lnk =129prv=202'); where the parameter values are record sets. What happens is that I get the first three params and then nothing. Any ideas? alex hogan * The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. *
RE: [PHP] Limitation to URL params on Include()?
Hi Alex, I'm going on the assumption that since you're using a URL parameter in the include, you have fopen_wrappers enabled, and the URL is external to your current site. Otherwise you'd just be doing a file system based include. I'm not certain if PHP is clipping the parameters. Though I would discourage this form of include for several reasons described below. Depending on the intent of your application, you may be using the wrong function. What are you trying to do? Pull the code of a php script into your script, or display the HTML output of a web page embedded in existing content? If you're trying to display the contents of another web page within your own, you may want to look at readfile(), read(), fopen() or even make a direct HTTP call to the server using sockets. Readfile() will read and output the HTML generated by the called page. read() and fopen() will get the output of that page and make it available to you for your own processing. These may be more suited for such a call, since you'll likely need to strip HTMLHEAD.../HEADBODY and /BODY tags out of the returned document (presuming your existing document has already displayed these). If you're trying to actually include the *script* code for execution within your program, this is a really dangerous thing to do. It means the called server gets to execute arbitrary code on your server. The code might not be arbitrary since you control it- but if your DNS were hacked, it means a clever hacker could actually insert a different script. Another point to consider- if you just want to display the HTML output of the included page, don't use include. If the external site were misconfigured, it may output raw php source rather than the interpreted HTML page. If this happens, that code will be run on your server in your current execution context. Again exposing you to arbitrary code being run on your server. Hope this helps, James Harrell http://celestia.cbstech.com -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 1:47 PM To: PHP General list Subject: [PHP] Limitation to URL params on Include()? Hi All, Is there a limit to the number of url parameters(other than the 256 limit) that you can have on a file that you are including? I have a file that I'm calling.., include('http://mydomain.com/block_display.php?id=1ttl=1011cnt=268lnk =129prv=202'); where the parameter values are record sets. What happens is that I get the first three params and then nothing. Any ideas? alex hogan * The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limitation to URL params on Include()?
Thanks James, I'm going on the assumption that since you're using a URL parameter in the include, you have fopen_wrappers enabled, Yes and the URL is external to your current site. Otherwise you'd just be doing a file system based include. No, the url is on my site... I have a file named block_content.php that is nothing more than a display block with graphics for effect. Instead of making several different display files I want to use a single one and just assign a different value to the variables $header, $content, $link.., and such. Then I can have as many of the content blocks on the same page as necessary to display content summaries. If I am headed in the wrong direction please let me know. What are you trying to do? Pull the code of a php script into your script, or display the HTML output of a web page embedded in existing content? Display HTML output. If you're trying to display the contents of another web page within your own, you may want to look at readfile(), read(), fopen() or even make a direct HTTP call to the server using sockets. Readfile() will read and output the HTML generated by the called page. read() and fopen() will get the output of that page and make it available to you for your own processing. OK... alex hogan * The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limitation to URL params on Include()?
Hi Alex, In that case, make your include file local; don't use the URL, use a relative path to the file. Make the include file have a function you can call or be an object you can instantiate. ex: block.php ?php function display_block($header,$content,$link,$andsuch) { // php code here to output HTML using echo... or ? ... direct html output here ... and a variable output such as ?php echo $header; ? and some more html, blah blah blah ?php } // end of display_block function ? Then in your main program do: ?php ... include_once(block.php); ... ... display_block($header,$content,$link,$andsuch); ... ... display_block($header2,$content2,$link2,$andsuch2); ... ... ? Or as an object: ... $block=new Block($header,$content,$link,$andsuch); $block-display(); ... Regards, James Harrell http://celestia.cbstech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limitation to URL params on Include()?
[snip] ... $block=new Block($header,$content,$link,$andsuch); $block-display(); ... [/snip] That's very cool... Thank you... alex hogan * The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php