...

View Full Version : Fields to submit



lmchaelichkatel
11-03-2009, 04:33 AM
Hi

I want to submit a post forum with curl, I need to specifies fields to send with option CURLOPT_POSTFIELDS, this option where I specify data to send with the form to submit.

I give the form in too examples the first is the real one with php content, and the second is html part after I execute it on my server. What I want to know is fields to send to CURLOPT_POSTFIELDS, all necessary fields including <input> and whatever.

I have a question is that I want to select checkbox and I want to check it but how to do that and send the checking option to CURLOPT_POSTFIELDS ?


<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />

The fields I think I should send are the last 6 hidden fields


<input type="hidden" name="option" value="com_content" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="redirect" value="<?php echo $redirect;?>" />
<input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />

and a field where to mention that I selected checkall.




<form action="index.php?option=com_content" method="post" name="adminForm">

<table>
<tr>
<td width="100%">
<?php echo ( 'Filter' ); ?>:
<input type="text" name="search" id="search" value="<?php echo $lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" title="<?php echo ( 'Filter by title or enter article ID' );?>"/>
<button onclick="this.form.submit();"><?php echo ( 'Go' ); ?></button>
<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_sectionid').value='-1';this.form.getElementById('catid').value='0';this.form.getElementById('filter_authorid').value='0' ;this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo ( 'Reset' ); ?></button>
</td>
<td nowrap="nowrap">
<?php
echo $lists['sectionid'];
echo $lists['catid'];
echo $lists['authorid'];
echo $lists['state'];
?>
</td>
</tr>
</table>

<table class="adminlist" cellspacing="1">
<thead>
<tr>
<th width="5">
<?php echo ( 'Num' ); ?>
</th>
<th width="5">
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
</th>
<th class="title">
<?php echo ('grid.sort', 'Title', 'c.title', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th width="1%" nowrap="nowrap">
<?php echo ('grid.sort', 'Published', 'c.state', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th nowrap="nowrap" width="1%">
<?php echo ('grid.sort', 'Front Page', 'frontpage', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th width="8%">
<?php echo ('grid.sort', 'Order', 'c.ordering', @$lists['order_Dir'], @$lists['order'] ); ?>
<?php if ($ordering) echo ('grid.order', $rows ); ?>
</th>
<th width="7%">
<?php echo ('grid.sort', 'Access', 'groupname', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th class="title" width="8%" nowrap="nowrap">
<?php echo ('grid.sort', 'Section', 'section_name', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th class="title" width="8%" nowrap="nowrap">
<?php echo ('grid.sort', 'Category', 'cc.title', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th class="title" width="8%" nowrap="nowrap">
<?php echo ('grid.sort', 'Author', 'author', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th align="center" width="10">
<?php echo ('grid.sort', 'Date', 'c.created', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th align="center" width="10">
<?php echo ('grid.sort', 'Hits', 'c.hits', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th width="1%" class="title">
<?php echo ('grid.sort', 'ID', 'c.id', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $page->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
$nullDate = $db->getNullDate();
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = &$rows[$i];

$link = 'index.php?option=com_content&sectionid='. $redirect .'&task=edit&cid[]='. $row->id;

$row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid );
$row->cat_link = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid );

$publish_up =& JFactory::getDate($row->publish_up);
$publish_down =& JFactory::getDate($row->publish_down);
$publish_up->setOffset($config->getValue('config.offset'));
$publish_down->setOffset($config->getValue('config.offset'));
if ( $now->toUnix() <= $publish_up->toUnix() && $row->state == 1 ) {
$img = 'publish_y.png';
$alt = ( 'Published' );
} else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) && $row->state == 1 ) {
$img = 'publish_g.png';
$alt = ( 'Published' );
} else if ( $now->toUnix() > $publish_down->toUnix() && $row->state == 1 ) {
$img = 'publish_r.png';
$alt = ( 'Expired' );
} else if ( $row->state == 0 ) {
$img = 'publish_x.png';
$alt = ( 'Unpublished' );
} else if ( $row->state == -1 ) {
$img = 'disabled.png';
$alt = ( 'Archived' );
}
$times = '';
if (isset($row->publish_up)) {
if ($row->publish_up == $nullDate) {
$times .= ( 'Start: Always' );
} else {
$times .= ( 'Start' ) .": ". $publish_up->toFormat();
}
}
if (isset($row->publish_down)) {
if ($row->publish_down == $nullDate) {
$times .= "<br />". ( 'Finish: No Expiry' );
} else {
$times .= "<br />". ( 'Finish' ) .": ". $publish_down->toFormat();
}
}

if ( $user->authorize( 'com_users', 'manage' ) ) {
if ( $row->created_by_alias ) {
$author = $row->created_by_alias;
} else {
$linkA = 'index.php?option=com_users&task=edit&cid[]='. $row->created_by;
$author = '<a href="'. JRoute::_( $linkA ) .'" title="'. ( 'Edit User' ) .'">'. $row->author .'</a>';
}
} else {
if ( $row->created_by_alias ) {
$author = $row->created_by_alias;
} else {
$author = $row->author;
}
}

$access = ('grid.access', $row, $i, $row->state );
$checked = ('grid.checkedout', $row, $i );
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<?php echo $page->getRowOffset( $i ); ?>
</td>
<td align="center">
<?php echo $checked; ?>
</td>
<td>
<?php
if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out ) ) {
echo $row->title;
} else if ($row->state == -1) {
echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8');
echo ' [ '. ( 'Archived' ) .' ]';
} else {
?>
<a href="<?php echo JRoute::_( $link ); ?>">
<?php echo htmlspecialchars($row->title, ENT_QUOTES); ?></a>
<?php
}
?>
</td>
<?php
if ( $times ) {
?>
<td align="center">
<span class="editlinktip hasTip" title="<?php echo ( 'Publish Information' );?>::<?php echo $times; ?>"><a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $row->state ? 'unpublish' : 'publish' ?>')">
<img src="images/<?php echo $img;?>" width="16" height="16" border="0" alt="<?php echo $alt; ?>" /></a></span>
</td>
<?php
}
?>
<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','toggle_frontpage')" title="<?php echo ( $row->frontpage ) ? ( 'Yes' ) : ( 'No' );?>">
<img src="images/<?php echo ( $row->frontpage ) ? 'tick.png' : ( $row->state != -1 ? 'publish_x.png' : 'disabled.png' );?>" width="16" height="16" border="0" alt="<?php echo ( $row->frontpage ) ? ( 'Yes' ) : ( 'No' );?>" /></a>
</td>
<td class="order">
<span><?php echo $page->orderUpIcon( $i, ($row->catid == @$rows[$i-1]->catid), 'orderup', 'Move Up', $ordering); ?></span>
<span><?php echo $page->orderDownIcon( $i, $n, ($row->catid == @$rows[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?></span>
<?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?>
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled; ?> class="text_area" style="text-align: center" />
</td>
<td align="center">
<?php echo $access;?>
</td>
<td>
<a href="<?php echo $row->sect_link; ?>" title="<?php echo ( 'Edit Section' ); ?>">
<?php echo $row->section_name; ?></a>
</td>
<td>
<a href="<?php echo $row->cat_link; ?>" title="<?php echo ( 'Edit Category' ); ?>">
<?php echo $row->name; ?></a>
</td>
<td>
<?php echo $author; ?>
</td>
<td nowrap="nowrap">
<?php echo ('date', $row->created, ('DATE_FORMAT_LC4') ); ?>
</td>
<td nowrap="nowrap" align="center">
<?php echo $row->hits ?>
</td>
<td>
<?php echo $row->id; ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
<?php ('content.legend'); ?>

<input type="hidden" name="option" value="com_content" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="redirect" value="<?php echo $redirect;?>" />
<input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />
</form>

The seem form after execution of php code :

lmchaelichkatel
11-03-2009, 04:35 AM
<form action="index.php?option=com_content" method="post" name="adminForm">

<table>
<tr>
<td width="100%">
Filter:
<input type="text" name="search" id="search" value="" class="text_area" onchange="document.adminForm.submit();" title="Filter by Title or enter an Article ID"/>
<button onclick="this.form.submit();">Go</button>
<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_sectionid').value='-1';this.form.getElementById('catid').value='0';this.form.getElementById('filter_authorid').value='0' ;this.form.getElementById('filter_state').value='';this.form.submit();">Reset</button>
</td>

<td nowrap="nowrap">
<select name="filter_sectionid" id="filter_sectionid" class="inputbox" size="1" onchange="document.adminForm.submit();"><option value="-1" >- Select Section -</option><option value="0" >Uncategorised</option><option value="4" >About Joomla!</option></select><select name="filter_authorid" id="filter_authorid" class="inputbox" size="1" onchange="document.adminForm.submit( );"><option value="0" selected="selected">- Select Author -</option><option value="0" selected="selected"></option><option value="62" >Site</option></select><select name="filter_state" id="filter_state" class="inputbox" size="1" onchange="submitform( );"><option value="" >- Select State -</option><option value="P" >Published</option><option value="U" selected="selected">Unpublished</option><option value="A" >Archived</option></select> </td>

</tr>
</table>

<table class="adminlist" cellspacing="1">
<thead>
<tr>
<th width="5">
# </th>
<th width="5">

<input type="checkbox" name="toggle" value="" onclick="checkAll(4);" />
</th>
<th class="title">
<a href="javascript:tableOrdering('c.title','desc','');" title="Click to sort by this column">Title</a> </th>
<th width="1%" nowrap="nowrap">
<a href="javascript:tableOrdering('c.state','desc','');" title="Click to sort by this column">Published</a> </th>
<th nowrap="nowrap" width="1%">

<a href="javascript:tableOrdering('frontpage','desc','');" title="Click to sort by this column">Front Page</a> </th>
<th width="8%">
<a href="javascript:tableOrdering('c.ordering','desc','');" title="Click to sort by this column">Order</a> <a href="javascript:saveorder(3, 'saveorder')" title="Save Order"><img src="/administrator/images/filesave.png" alt="Save Order" /></a> </th>
<th width="7%">
<a href="javascript:tableOrdering('groupname','desc','');" title="Click to sort by this column">Access Level</a> </th>

<th class="title" width="8%" nowrap="nowrap">
<a href="javascript:tableOrdering('section_name','desc','');" title="Click to sort by this column">Section<img src="/administrator/images/sort_asc.png" alt="" /></a> </th>
<th class="title" width="8%" nowrap="nowrap">
<a href="javascript:tableOrdering('cc.title','desc','');" title="Click to sort by this column">Category</a> </th>
<th class="title" width="8%" nowrap="nowrap">
<a href="javascript:tableOrdering('author','desc','');" title="Click to sort by this column">Author</a> </th>

<th align="center" width="10">
<a href="javascript:tableOrdering('c.created','desc','');" title="Click to sort by this column">Date</a> </th>
<th align="center" width="10">
<a href="javascript:tableOrdering('c.hits','desc','');" title="Click to sort by this column">Hits</a> </th>
<th width="1%" class="title">
<a href="javascript:tableOrdering('c.id','desc','');" title="Click to sort by this column">ID</a> </th>

</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<del class="container"><div class="pagination">

<div class="limit">Display #<select name="limit" id="limit" class="inputbox" size="1" onchange="submitform();"><option value="5" >5</option><option value="10" >10</option><option value="15" >15</option><option value="20" >20</option><option value="25" >25</option><option value="30" >30</option><option value="50" >50</option><option value="100" >100</option><option value="0" selected="selected">all</option></select></div>

<div class="limit"></div>
<input type="hidden" name="limitstart" value="0" />
</div></del> </td>
</tr>
</tfoot>
<tbody>
<tr class="row0">
<td>
1 </td>

<td align="center">
<input type="checkbox" id="cb0" name="cid[]" value="3679" onclick="isChecked(this.checked);" /> </td>
<td>
<a href="index.php?option=com_content&amp;sectionid=-1&amp;task=edit&amp;cid[]=3679">
Guidelines for financial journalists</a>
</td>
<td align="center">
<span class="editlinktip hasTip" title="Publish Information::Start: 2009-10-22 21:24:12<br />Finish: 2010-07-19 21:14:12"><a href="javascript:void(0);" onclick="return listItemTask('cb0','publish')">

<img src="images/publish_x.png" width="16" height="16" border="0" alt="Unpublished" /></a></span>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb0','toggle_frontpage')" title="No">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="No" /></a>
</td>
<td class="order">
<span>&nbsp;</span>
<span><a href="#reorder" onclick="return listItemTask('cb0','orderdown')" title="Move Down"> <img src="images/downarrow.png" width="16" height="16" border="0" alt="Move Down" /></a></span>

<input type="text" name="order[]" size="5" value="1" class="text_area" style="text-align: center" />
</td>
<td align="center">

<a href="javascript:void(0);" onclick="return listItemTask('cb0','accessregistered')" style="color: green;">
Public</a> </td>
<td>
<a href="index.php?option=com_sections&amp;task=edit&amp;cid[]=16" title="Edit Section">
mSection</a>

</td>
<td>
<a href="index.php?option=com_categories&amp;task=edit&amp;cid[]=80" title="Edit Category">
mCategory</a>
</td>
<td>
<a href="index.php?option=com_users&amp;task=edit&amp;cid[]=62" title="Edit User">Site</a> </td>

<td nowrap="nowrap">
01.07.05 </td>
<td nowrap="nowrap" align="center">
0 </td>
<td>
3679 </td>
</tr>

<tr class="row1">
<td>
2 </td>
<td align="center">
<input type="checkbox" id="cb1" name="cid[]" value="3678" onclick="isChecked(this.checked);" /> </td>
<td>
<a href="index.php?option=com_content&amp;sectionid=-1&amp;task=edit&amp;cid[]=3678">
Robert Peston's blog: Keep up-to-date with the latest business analysis</a>

</td>
<td align="center">
<span class="editlinktip hasTip" title="Publish Information::Start: 2009-10-22 21:24:12<br />Finish: 2010-07-19 21:14:12"><a href="javascript:void(0);" onclick="return listItemTask('cb1','publish')">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="Unpublished" /></a></span>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb1','toggle_frontpage')" title="No">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="No" /></a>
</td>

<td class="order">
<span><a href="#reorder" onclick="return listItemTask('cb1','orderup')" title="Move Up"> <img src="images/uparrow.png" width="16" height="16" border="0" alt="Move Up" /></a></span>
<span><a href="#reorder" onclick="return listItemTask('cb1','orderdown')" title="Move Down"> <img src="images/downarrow.png" width="16" height="16" border="0" alt="Move Down" /></a></span>
<input type="text" name="order[]" size="5" value="2" class="text_area" style="text-align: center" />
</td>
<td align="center">

<a href="javascript:void(0);" onclick="return listItemTask('cb1','accessregistered')" style="color: green;">
Public</a> </td>

<td>
<a href="index.php?option=com_sections&amp;task=edit&amp;cid[]=16" title="Edit Section">
mSection</a>
</td>
<td>
<a href="index.php?option=com_categories&amp;task=edit&amp;cid[]=80" title="Edit Category">
mCategory</a>
</td>

<td>
<a href="index.php?option=com_users&amp;task=edit&amp;cid[]=62" title="Edit User">Site</a> </td>
<td nowrap="nowrap">
17.09.08 </td>
<td nowrap="nowrap" align="center">
0 </td>
<td>

3678 </td>
</tr>
<tr class="row0">
<td>
3 </td>
<td align="center">
<input type="checkbox" id="cb2" name="cid[]" value="3676" onclick="isChecked(this.checked);" /> </td>

<td>
<a href="index.php?option=com_content&amp;sectionid=-1&amp;task=edit&amp;cid[]=3676">
British Airways boss says people only fly because they have to</a>
</td>
<td align="center">
<span class="editlinktip hasTip" title="Publish Information::Start: 2009-10-22 21:24:12<br />Finish: 2010-07-19 21:14:12"><a href="javascript:void(0);" onclick="return listItemTask('cb2','publish')">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="Unpublished" /></a></span>
</td>

<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb2','toggle_frontpage')" title="No">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="No" /></a>
</td>
<td class="order">
<span><a href="#reorder" onclick="return listItemTask('cb2','orderup')" title="Move Up"> <img src="images/uparrow.png" width="16" height="16" border="0" alt="Move Up" /></a></span>
<span><a href="#reorder" onclick="return listItemTask('cb2','orderdown')" title="Move Down"> <img src="images/downarrow.png" width="16" height="16" border="0" alt="Move Down" /></a></span>
<input type="text" name="order[]" size="5" value="4" class="text_area" style="text-align: center" />

</td>
<td align="center">

<a href="javascript:void(0);" onclick="return listItemTask('cb2','accessregistered')" style="color: green;">
Public</a> </td>
<td>
<a href="index.php?option=com_sections&amp;task=edit&amp;cid[]=16" title="Edit Section">
mSection</a>

</td>
<td>
<a href="index.php?option=com_categories&amp;task=edit&amp;cid[]=80" title="Edit Category">
mCategory</a>
</td>
<td>
<a href="index.php?option=com_users&amp;task=edit&amp;cid[]=62" title="Edit User">Site</a> </td>

<td nowrap="nowrap">
19.10.09 </td>
<td nowrap="nowrap" align="center">
0 </td>
<td>
3676 </td>
</tr>

<tr class="row1">
<td>
4 </td>
<td align="center">
<input type="checkbox" id="cb3" name="cid[]" value="3675" onclick="isChecked(this.checked);" /> </td>
<td>
<a href="index.php?option=com_content&amp;sectionid=-1&amp;task=edit&amp;cid[]=3675">
Oil price hits new high for 2009</a>

</td>
<td align="center">
<span class="editlinktip hasTip" title="Publish Information::Start: 2009-10-22 21:24:12<br />Finish: 2010-07-19 21:14:12"><a href="javascript:void(0);" onclick="return listItemTask('cb3','publish')">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="Unpublished" /></a></span>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb3','toggle_frontpage')" title="No">
<img src="images/publish_x.png" width="16" height="16" border="0" alt="No" /></a>
</td>

<td class="order">
<span><a href="#reorder" onclick="return listItemTask('cb3','orderup')" title="Move Up"> <img src="images/uparrow.png" width="16" height="16" border="0" alt="Move Up" /></a></span>
<span>&nbsp;</span>
<input type="text" name="order[]" size="5" value="5" class="text_area" style="text-align: center" />
</td>
<td align="center">

<a href="javascript:void(0);" onclick="return listItemTask('cb3','accessregistered')" style="color: green;">
Public</a> </td>

<td>
<a href="index.php?option=com_sections&amp;task=edit&amp;cid[]=16" title="Edit Section">
mSection</a>
</td>
<td>
<a href="index.php?option=com_categories&amp;task=edit&amp;cid[]=80" title="Edit Category">
mCategory</a>
</td>

<td>
<a href="index.php?option=com_users&amp;task=edit&amp;cid[]=62" title="Edit User">Site</a> </td>
<td nowrap="nowrap">
19.10.09 </td>
<td nowrap="nowrap" align="center">
0 </td>
<td>

3675 </td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="4" border="0" align="center">
<tr align="center">
<td>
<img src="images/publish_y.png" width="16" height="16" border="0" alt="Pending" />

</td>
<td>
Published, but is <u>Pending</u> |
</td>
<td>
<img src="images/publish_g.png" width="16" height="16" border="0" alt="Visible" />
</td>
<td>

Published and is <u>Current</u> |
</td>
<td>
<img src="images/publish_r.png" width="16" height="16" border="0" alt="Finished" />
</td>
<td>
Published, but has <u>Expired</u> |
</td>

<td>
<img src="images/publish_x.png" width="16" height="16" border="0" alt="Finished" />
</td>
<td>
Not Published |
</td>
<td>
<img src="images/disabled.png" width="16" height="16" border="0" alt="Archived" />
</td>

<td>
Archived </td>
</tr>
<tr>
<td colspan="10" align="center">
Click on icon to toggle state. </td>
</tr>
</table>


<input type="hidden" name="option" value="com_content" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="redirect" value="-1" />
<input type="hidden" name="filter_order" value="section_name" />
<input type="hidden" name="filter_order_Dir" value="" />



Thinks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum