Dynamic Target URL for CURL

KMonsefi 25 Jul, 2009
Hi,
I need to set my CURL form URL dynamically. I tried putting the following in the "Extra before CURL code" box, but it's not working:

<?php
$params->target_url = "http://mydomain.com/lists/?p=preferences&uid=" . $phplist_user->uniqid;
?>

How can I set the URL dynamically?

Thanks!
GreyHead 26 Jul, 2009
Hi KMonsefi,

The Target URL is just for the root part http://mydomain.com/lists/ add all the parameters in the other tab. In this case p=preferences in the lower text area and the variable parameter uid in the upper array.

To get this to work you will need to create a field in your form corresponding to the uid, A hidden field will work OK
<input type='hidden' name='uid' value='' />


Then you can use the Extra Before CURL box to set the value
<?php
JRequest::setVar('uid', $phplist_user->uniqid, 'post');
?>
and put the field name in the corresponding field in the parameters tab uid : uid in this case.

Bob
KMonsefi 26 Jul, 2009
OK, here's what I ended up doing to get a dynamic target URL:

In my form, I added the following code:
<input type="hidden" name="chrono_target_url" value="http://mydomain.com/lists/?p=preferences&uid=<?php echo $phplist_user->uniqid; ?>">

I did this since variables calculated in my form are NOT available in the "Extra before CURL code" box. So, this is what I now had to put in the "Extra before CURL code box" to get it to work:

<?php
$params->set('target_url', $_POST['chrono_target_url']);
?>
This topic is locked and no more replies can be posted.