PDA

View Full Version : Calling content.php with a specific query ID from a php script


B-runner
06-17-2013, 10:04 PM
I am trying to find a way to call content.php with a query string from another php script. Without a query string, a stripped down version of the script, that works, would be:

<?php
include("content.php");
die();
?>

but the include does not allow a query string. So I've been trying various forms of using $_GET, $_SERVER, $_SESSION and by using curl as others recommend (elsewhere), but I'm not finding the right way. Curl might work but I'm getting a "Request Entity Too Large" error. :(

So this reads as to what I'm after:
<?php
include("content.php?###");
die();
?>

Where ### is a predefined constant- but again, it's not supported.



I was also wondering if there is a way to do it within VB, if you look into content.php, you'll see:

define('VB_PRODUCT', 'vbcms');
define('VB_ENTRY', 1);
define('VB_ROUTER_SEGMENT', 'content');
define('GET_EDIT_TEMPLATES', 'picture');
define('CMS_SCRIPT', true);
define('THIS_SCRIPT', 'vbcms');
define('FRIENDLY_URL_LINK', 'vbcms');

// Bootstrapping
require_once('vb/bootstrap.php');


Is it possible to define the page number ID before calling the bootstrap.php (or content.php)? Where does the query string get parsed anyway?


I'm just starting to work with VB & php, so thank you for any help!

kh99
06-17-2013, 11:13 PM
I believe you should be able to set parameters by setting $_GET and/or $_REQUEST. It depends on which parameters you're trying to set and how the vb code looks for them.

I don't know exactly what your script does, but maybe you could do what you're trying to do using plugins?

B-runner
06-18-2013, 12:27 AM
Thanks, kh99.

What I'm really trying to do is this:
<?php
include("content.php?###");
die();
?>

Based on some account, one should be able to use $_GET as follows to make it work:
<?php
$_GET['###']="0";
include("content.php");
die();
?>
But it doesn't, it just servers up the default content.php so using $_GET in this way didn't work. I'm not sure if there is a proper use of GET for this. As an side note, I realized VB is unusual in how it uses the query string since there is no =, you just get the query term.

I will look into $_REQUEST - but you're right, it depends how VB is looking for things, so that is why I was wondering where it parses the query string? I gave up on that for now after looking in the bootstrap.php since it gets into a lot of PHP code I'm not at all familiar with.

kh99
06-18-2013, 10:04 AM
...but you're right, it depends how VB is looking for things, so that is why I was wondering where it parses the query string?

Oh, sorry, that's what you were asking. I see now, content.php is different in that it seems to do it's own parsing of the url. It looks like maybe it's in class_core.php, function resolve_request_url(), around line 2070, but I'm not sure. That code looks like it uses one of the values out of $_SERVER that has the url as a string.