Page 1 of 1

Fields to submit

Posted: Mon Nov 02, 2009 9:22 pm
by lmchaelichkatel
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 ?

Code: Select all

<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

Code: Select all

<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.


Code: Select all

<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&#058;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&#058;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 :

Code: Select all

 
<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&#058;tableOrdering('c.title','desc','');" title="Click to sort by this column">Title</a>                    </th>
                    <th width="1%" nowrap="nowrap">
                        <a href="javascript&#058;tableOrdering('c.state','desc','');" title="Click to sort by this column">Published</a>                    </th>
                    <th nowrap="nowrap" width="1%">
 
                        <a href="javascript&#058;tableOrdering('frontpage','desc','');" title="Click to sort by this column">Front Page</a>                 </th>
                    <th width="8%">
                        <a href="javascript&#058;tableOrdering('c.ordering','desc','');" title="Click to sort by this column">Order</a>                     <a href="javascript&#058;saveorder(3, 'saveorder')" title="Save Order"><img src="/administrator/images/filesave.png" alt="Save Order"  /></a>                   </th>
                    <th width="7%">
                        <a href="javascript&#058;tableOrdering('groupname','desc','');" title="Click to sort by this column">Access Level</a>                   </th>
 
                    <th class="title" width="8%" nowrap="nowrap">
                        <a href="javascript&#058;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&#058;tableOrdering('cc.title','desc','');" title="Click to sort by this column">Category</a>                    </th>
                    <th  class="title" width="8%" nowrap="nowrap">
                        <a href="javascript&#058;tableOrdering('author','desc','');" title="Click to sort by this column">Author</a>                    </th>
 
                    <th align="center" width="10">
                        <a href="javascript&#058;tableOrdering('c.created','desc','');" title="Click to sort by this column">Date</a>                   </th>
                    <th align="center" width="10">
                        <a href="javascript&#058;tableOrdering('c.hits','desc','');" title="Click to sort by this column">Hits</a>                  </th>
                    <th width="1%" class="title">
                        <a href="javascript&#058;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&sectionid=-1&task=edit&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&#058;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&#058;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&#058;void(0);" onclick="return listItemTask('cb0','accessregistered')" style="color: green;">
            Public</a>                  </td>
                        <td>
                            <a href="index.php?option=com_sections&task=edit&cid[]=16" title="Edit Section">
                                mSection</a>
 
                        </td>
                    <td>
                        <a href="index.php?option=com_categories&task=edit&cid[]=80" title="Edit Category">
                            mCategory</a>
                    </td>
                    <td>
                        <a href="index.php?option=com_users&task=edit&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&sectionid=-1&task=edit&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&#058;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&#058;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&#058;void(0);" onclick="return listItemTask('cb1','accessregistered')" style="color: green;">
            Public</a>                  </td>
 
                        <td>
                            <a href="index.php?option=com_sections&task=edit&cid[]=16" title="Edit Section">
                                mSection</a>
                        </td>
                    <td>
                        <a href="index.php?option=com_categories&task=edit&cid[]=80" title="Edit Category">
                            mCategory</a>
                    </td>
 
                    <td>
                        <a href="index.php?option=com_users&task=edit&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&sectionid=-1&task=edit&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&#058;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&#058;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&#058;void(0);" onclick="return listItemTask('cb2','accessregistered')" style="color: green;">
            Public</a>                  </td>
                        <td>
                            <a href="index.php?option=com_sections&task=edit&cid[]=16" title="Edit Section">
                                mSection</a>
 
                        </td>
                    <td>
                        <a href="index.php?option=com_categories&task=edit&cid[]=80" title="Edit Category">
                            mCategory</a>
                    </td>
                    <td>
                        <a href="index.php?option=com_users&task=edit&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&sectionid=-1&task=edit&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&#058;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&#058;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&#058;void(0);" onclick="return listItemTask('cb3','accessregistered')" style="color: green;">
            Public</a>                  </td>
 
                        <td>
                            <a href="index.php?option=com_sections&task=edit&cid[]=16" title="Edit Section">
                                mSection</a>
                        </td>
                    <td>
                        <a href="index.php?option=com_categories&task=edit&cid[]=80" title="Edit Category">
                            mCategory</a>
                    </td>
 
                    <td>
                        <a href="index.php?option=com_users&task=edit&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

Re: Fields to submit

Posted: Mon Nov 02, 2009 10:33 pm
by Eric!
Try using a tool like tamperdata or webscarab. With this tool you can intercept the posted data and see the exact format, settings and field names. So you can use your browser and fill out the form like you want and capture the submission. Then just duplicate that in php...

Re: Fields to submit

Posted: Tue Nov 03, 2009 9:20 am
by lmchaelichkatel
Thinks you both for your reply, the extension looks great. The problem is that the number of checkbox is not determined "I don't know it" because it depend on the number of articles to delete, this number can change from session to an other. The procedure of sending form is clear but need some trick, below to examples the first I select only two checkboxs the second I selected all checkboxs using check all "I work manually right now". In this example I have 4 articles but generally the number is not determined because this form delete all articles that has been published for more than one week and this number may change depending on reductions.


Example 1:
Image
Image

Example 2:
Image
Image


Each article "or checkbox" has :

1 -An order "order[]" for example the first checkbox is in the order 1 so the value of order[] is 1.

Code: Select all

 
<input type="text" name="order[]" size="5" value="1"  class="text_area" style="text-align: center" />
 
2 - An identifier or "cid[]" for example for the first checkbox has an identifier value of 48

Code: Select all

 
<input type="checkbox" id="cb0" name="cid[]" value="48" onclick="isChecked(this.checked);" />
 
Idea :

When I grab the source code of page in variable $html with function curl_exec(). My idea is to do the following :

1 - Count the number of checkboxs "articles" on the page "in $html", this number is N "N can be 0 or 1 or 2 or 5 or 100 ... whatever".
2 - Create an array which associate for each "cid[]" value the order associated to it.

Code: Select all

 
$checkboxArray = array();
 
// For each order from value 1 to N, associate its correspondent identifier value to arrive to " See Example 2" :
$checkboxArray : 1 ==> 48
$checkboxArray :2 ==> 47
$checkboxArray : 3  ==> 46
$checkboxArray : 4 ==> 42
 
// The create the final Array which should looks like :
 
$finalArray : cid[] ==> 48
$finalArray : order[] ==> 1
$finalArray : cid[] ==> 47
$finalArray : order[] ==> 2
$finalArray : cid[] ==> 46
$finalArray : order[] ==> 3
$finalArray : cid[] ==> 42
$finalArray : order[] ==> 4
 
// That is it, we add data of $finalArray to the array which will be send to CURLOPT_POSTFIELDS
 
This is not easy, I can't do it my self.

Thinks

Re: Fields to submit

Posted: Tue Nov 03, 2009 11:08 am
by lmchaelichkatel
Hi, I hear that php DOM can simulate a manual user checkbox and submit button exactly it is like if a human who visit the page and click but it is not human it is the server with curl. If this is possible than I think it could be more easier than sending form.

Code: Select all

<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
$row is the number of checkbox on the page, DOM can count this number.

Code: Select all

<a class="toolbar" onclick="javascript&#058;if(document.adminForm.boxchecked.value==0){alert('Please select an article from the list');}else{ submitbutton('unpublish')}" href="#">
Generate the event ubmitbutton('unpublish') if click on the button unpublish.

Think You and hope that helps.

Re: Fields to submit

Posted: Tue Nov 03, 2009 3:36 pm
by lmchaelichkatel
Hi,

I have a section its id or "sectionid" is 16. In this section any article which has acceded one week became unpublished. What I want to do is to delete all unpublished articles of this section from database "not just send articles to trash but delete completely". I want to do this to limiting database size. The idea is to do this with curl but I have no idea if this task can be done using mySQL query, if it is possible why not.

Thinks.