Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Check a random radio button using it's value
Old 12-13-2009, 05:25 PM Check a random radio button using it's value
Junior Talker

Posts: 2
Location: The Netherlands
Trades: 0
Hi, i'm trying to get a random radio button checked and submit on a page i don't own.

Part of the html of the page the radio buttons are on:
HTML Code:
<td><input name="bust" value="5163402" type="radio" onclick="document.jail.ver.focus();"></td>
                <td><a href="jail.php?buyout=5163402"><font color='#000000'> ($7,500)</font></a></td>
            </tr>
                <tr bgcolor="">
                <td><font color='#000000'><a href="user.php?nick=Lordluke"><font color='#000000'>Lordluke</font></a></font></td>
                <td><font color='#000000'><a href=family.php?fam=125><font color='#000000'>Andronova</font></a></font></td>
                <td><font color='#000000'>Attempted jail break</font></td>
                <td><font color='#000000'><span id="counter_jail8_minutes" style="display: inline;"><span id="counter_jail8_minutes_value">04</span> </span> <span id="counter_jail8_seconds" style="display: inline;"><span id="counter_jail8_seconds_value">43</span> </span><script language="javascript" type="text/javascript">
var oTimer = new Timer("jail8");
oTimer.setTime(283);
oTimer.setRefresh(false);
oTimer.setFinal("");
aTimers["jail8"] = oTimer;
</script>
</font></td>
Now the value for the different radio buttons vary everytime this html page is visited.
I've tried different approaches but don't seem to get it right.

Parts of php code i had:
PHP Code:
$jailArray = array($res->find('center' 0)->find('table'0)->find('input(value[])'));
                 foreach (
$jailArray as $key => $value); {
                    
output ($key " " $value );
                    }
                    
$random array_rand($jailArray,1);
                    
$jailChoice = ($res->find('center' 0)->find('table'0)->find('input(value[$jailArray[$random]])'));
                    unset (
$jailArray); 
Which is totally wrong i think :x

PHP Code:
$jailRadio = ($jRadio -1);
     
$jChoice rand(0, ("$jailRadio"));
      
debug ("Random radiobutton chosen: " . ($jChoice));
      
$jailChoice = ($res->find('center'0)->find('table'0)->find('input[type=radio]', ($jChoice)));
      
debug ("Check the " $jChoice " th radiobutton in jail."); 
This only divines a number thus can't be used with SubmitForm


PHP Code:
$radio = ($res->find('center' 0)->find('table'0)->find('input[type=radio]'1));
$res->value(); 
Yet another attemp going no where.


Is there anyone who can help me a little bit further with this?
The idea is to get this html page Submit with a random radio button checked.
Thanks in advance.
_KING_VIS_ is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-14-2009, 03:45 AM Re: Check a random radio button using it's value
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
(Ignoring the spam posts above)
I dont quite understand what you want to do. The code you submitted just makes no sense to me, I dont know at all what you're trying to accomplish. Can't you just add a selected="selected" to the radio button if you want it checked?
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 12-14-2009, 09:46 AM Re: Check a random radio button using it's value
Junior Talker

Posts: 2
Location: The Netherlands
Trades: 0
The problem is, the html page the radio buttons are on is not mine.

So basicly i'm trying to submit a form on a website with a random radio button selected.
Every time this page is visited the amount of radiobuttons vary and so does their value.


Let me post a full html page on pastebin:
http://pastebin.com/m4a179420

Last edited by _KING_VIS_; 12-14-2009 at 09:50 AM.. Reason: Adding full html page
_KING_VIS_ is offline
Reply With Quote
View Public Profile
 
Old 12-14-2009, 02:24 PM Re: Check a random radio button using it's value
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Aha. This isn't my strong point at all. :P
I think you can use curl (which I dont know much about) to send a POST request where you can include what buttons you want to select, but I don't know how this is actually done.

But before that I guess you'd have to retrieve and read the whole page with the form (as a string), then search it in order to find the form action attribute and all the radio buttons and their respective name attribute. With this information you should be able to send a POST request (as said above) with the radio buttons selected.

This probably won't help that much , but somebody else can probably fill in
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Reply     « Reply to Check a random radio button using it's value
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21779 seconds with 12 queries