为什么cURL会进入无限循环?

时间:2011-09-20 20:23:42

标签: php forms post curl

我在发布网址表时遇到问题。当我运行cURL时,它看起来像是进入无限循环;它根本不会停止。当我做简单的表格时,这是可以的:

<form action="#" method="post">

Name: <input type="text" name="na" />

<input type="submit" value="Send" />

</form>

但是当我尝试在PHPBB3论坛脚本上提交帖子时,其中有一些类似的表单,脚本不会停止。

我是否必须为每个输入确定变量,即使有2个表单而我只想提交其中一个?

cURL代码:

<form action="zd.php" method="post">
Link: <input type="text" name="linko" /><br />
<input type="submit" value="Salji" />
<input type="hidden" name="sad" value="sad" />
</form>



<?php

if (isset($_POST['sad'])) {

$imos = trim($_POST['linko']);

$koja = curl_init("http://link/index.php");

$kooky = "PHPSESSID=9opvpblp3govbrfg27t0a8jki6";

$po = array(
    'link'=>$imos,
    'referer'=>' ',
    'submit'=>'Transload File');

curl_setopt($koja, CURLOPT_COOKIE, $kooky);
curl_setopt($koja, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($koja, CURLOPT_POST, 1);
curl_setopt($koja, CULROPT_POSTFIELDS, $po);

curl_exec($koja);

echo "<br />ERROR: ".curl_error($koja);

}

?>

我要发布的页面(整个表单):

<form action="/index.php" name="transload" method="post"> 
<table class="tab-content" id="tb1" cellspacing="5" width="100%"> 
<tbody> 
<tr> 
<td align="left"> 
<b>Link to Transload:</b><br />&nbsp;<input type="text" name="link" id="link" size="50" /><br /><br /> 
<b>Referrer:</b><br />&nbsp;<input type="text" name="referer" id="referer" size="50" /> 
</td> 
<td align="center"> 
<input value="Transload File" type="submit" /> 
</td> 
</tr> 
<tr> 
<td align="left"><input type="checkbox" name="user_pass" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('usernpass').style.display=displ;" value="on" />&nbsp;User &amp; Pass (HTTP/FTP)</td> 
</tr> 
<tr id="usernpass" style="display: none;"> 
<td align="center"> 
User: <input type="text" name="iuser" value="" /><br /> 
Pass: <input type="text" name="ipass" value="" /> 
</td> 
</tr> 
<tr> 
<td align="left"><input type="checkbox" name="add_comment" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('comment').style.display=displ;" />&nbsp;Add Comments</td> 
</tr> 
<tr id="comment" style="display: none;"> 
<td> 
<textarea name="comment" rows="4" cols="50"></textarea> 
</td> 
</tr> 
<tr><td>&nbsp;</td></tr> 
<tr> 
<td align="left"> 
<small style="color:#55bbff">PluginOptions:</small><hr /> 
<label><input type="checkbox" name="dis_plug" />&nbsp;<small>Disable All Plugins</small></label> 
</td> 
</tr> 
<tr> 
<td align="left"> 
<label><input type="checkbox" name="ytube_mp4" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('ytubeopt').style.display=displ;" />&nbsp;<small>YouTube Video Format Selector</small></label> 
<table width="150" border="0" id="ytubeopt" style="display: none;"> 
<tr> 
<td colspan="2" style="white-space: nowrap;"><input type="checkbox" name="ytdirect" /><small>&nbsp;Direct Link</small></td> 
</tr> 
<tr> 
<td align="left"><small>&amp;fmt=</small></td> 
<td align="left"> 
<select name="yt_fmt" id="yt_fmt"> 
<option value="highest" selected="selected">Auto-get the highest quality format available</option> 
<option value="0">0 [Video: FLV H263 251kbps 320x180 @ 29.896fps | Audio: MP3 64kbps 1ch @ 22.05kHz]</option> 
<option value="5">5 [Video: FLV H263 251kbps 320x180 @ 29.885fps | Audio: MP3 64kbps 1ch @ 22.05kHz]</option> 
<option value="6">6 [Video: FLV H263 892kbps 480x270 @ 29.887fps | Audio: MP3 96kbps 1ch @ 44.10kHz]</option> 
<option value="13">13 [Video: 3GP H263 77kbps 176x144 @ 15.000fps | Audio: AMR 13kbps 1ch @ 8.000kHz]</option> 
<option value="17">17 [Video: 3GP XVID 55kbps 176x144 @ 12.000fps | Audio: AAC 29kbps 1ch @ 22.05kHz]</option> 
<option value="18">18 [Video: MP4 H264 505kbps 480x270 @ 29.886fps | Audio: AAC 125kbps 2ch @ 44.10kHz]</option> 
<option value="22">22 [Video: MP4 H264 2001kbps 1280x720 @ 29.918fps | Audio: AAC 198kbps 2ch @ 44.10kHz]</option> 
<option value="34">34 [Video: FLV H264 256kbps 320x180 @ 29.906fps | Audio: AAC 62kbps 2ch @ 22.05kHz]</option> 
<option value="35">35 [Video: FLV H264 831kbps 640x360 @ 29.942fps | Audio: AAC 107kbps 2ch @ 44.10kHz]</option> 
<option value="37">37 [Video: MP4 1920×1080 | Audio: AAC 2ch 44.10kHz]</option> 

</select> 
</td> 
</tr> 
</table> 
</td> 
</tr> 
<tr> 
<td align="left"><label><input type="checkbox" name="imageshack_tor" id="imageshack_tor" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('torpremiumblock').style.display=displ;"  />&nbsp;<small>ImageShack&reg; TorrentService</small></label><table width="150" border="0" id="torpremiumblock" style="display: none;"> 
<tr><td>Username:&nbsp;</td><td><input type="text" name="tor_user" id="tor_user" size="15" value="" /></td></tr> 
<tr><td>Password:&nbsp;</td><td><input type="password" name="tor_pass" id="tor_pass" size="15" value="" /></td></tr> 
</table> 
</td> 
</tr> 
<tr> 
<td align="left"> 
<label><input type="checkbox" name="mu_acc" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('mupremiumblock').style.display=displ;"  />&nbsp;<small>Megaupload.com Cookie Value</small></label> 
<table width="150" border="0" id="mupremiumblock" style="display: none;"> 
<tr><td>user=</td><td><input type="text" name="mu_cookie" id="mu_cookie" size="25" value="" /></td></tr> 
</table> 
</td> 
</tr> 
<tr> 
<td align="left"> 
<label><input type="checkbox" name="vBulletin_plug" />&nbsp;<small>Use vBulletin Plugin</small></label> 
</td> 
</tr> 
<tr> 
<td align="left"> 
<label><input type="checkbox" name="cookieuse" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('cookieblock').style.display=displ;" />&nbsp;<small>Additional Cookie Value</small></label> 
<table width="150" border="0" id="cookieblock" style="display: none;"> 
<tr><td>Key=Value;</td><td><input type="text" name="cookie" id="cookie" size="25" value="" /></td></tr> 
</table> 
</td> 
</tr> 
</tbody> 
</table> 
<table class="hide-table" id="tb2" cellspacing="5" width="100%"> 
<tbody> 
<tr> 
<td align="center"> 
<table align="center" style="text-align: justify;"> 
<tr> 
<td><input type="checkbox" name="domail" id="domail" onclick="document.getElementById('emailtd').style.display=document.getElementById('splittd').style.display=this.checked?'':'none';document.getElementById('methodtd').style.display=(document.getElementById('splitchkbox').checked ? (this.checked ? '' : 'none') : 'none');" />&nbsp;Send File to Email</td> 
<td>&nbsp;</td> 
<td id="emailtd" style="display: none;">Email:&nbsp;<input type="text" name="email" id="email" /></td> 
</tr> 
<tr> 
<td></td> 
</tr> 
<tr id="splittd" style="display: none;"> 
<td> 
<input id="splitchkbox" type="checkbox" name="split" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('methodtd').style.display=displ;" />&nbsp;Split Files</td> 
<td>&nbsp;</td> 
<td id="methodtd" style="display: none;"> 
<table> 
<tr> 
<td>Method:&nbsp;<select name="method"><option value="tc">Total Commander</option><option value="rfc">RFC 2046</option></select></td> 
</tr> 
<tr> 
<td>Parts Size:&nbsp;<input type="text" name="partSize" size="2" value="10" />&nbsp;MB</td> 
</tr> 
</table> 
</td> 
</tr> 
<tr> 
<td><input type="checkbox" id="useproxy" name="useproxy" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('proxy').style.display=displ;" />&nbsp;Use Proxy Settings</td> 
<td>&nbsp;</td> 
<td id="proxy" style="display: none;"> 
<table width="150" border="0"> 
<tr><td>Proxy:&nbsp;</td><td><input type="text" name="proxy" id="proxyproxy" size="20" /></td></tr> 
<tr><td>Username:&nbsp;</td><td><input type="text" name="proxyuser" id="proxyuser" size="20" /></td></tr> 
<tr><td>Password:&nbsp;</td><td><input type="text" name="proxypass" id="proxypass" size="20" /></td></tr> 
</table> 
</td> 
</tr> 
<tr> 
<td></td> 
</tr> 
<tr> 
<td><input type="checkbox" name="premium_acc" id="premium_acc" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('premiumblock').style.display=displ;" checked="checked" />&nbsp;Use Premium Account</td> 
<td>&nbsp;</td> 
<td id="premiumblock" style="display: none;"> 
<table width="150" border="0"> 
<tr><td>Username:&nbsp;</td><td><input type="text" name="premium_user" id="premium_user" size="15" value="" /></td></tr> 
<tr><td>Password:&nbsp;</td><td><input type="password" name="premium_pass" id="premium_pass" size="15" value="" /></td></tr> 
</table> 
</td> 
</tr> 
<tr> 
<td></td> 
</tr> 
<tr style="display:none;"> 
<td><input type="checkbox" name="saveto" id="saveto" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('path').style.display=displ;" />&nbsp;Save To</td> 
<td>&nbsp;</td> 
<td id="path" style="display: none;">Path:&nbsp;<input type="text" name="path" size="40" value="/home/zdorian/public_html/files" /></td> 
</tr> 
<tr> 
<td></td> 
</tr> 
<tr> 
<td><input type="checkbox" name="savesettings" id="savesettings" onclick="javascript:var displ=this.checked?'':'none';document.getElementById('clearsettings').style.display=displ;" />&nbsp;Save Settings</td> 
<td>&nbsp;</td> 
<td id="clearsettings" style="display: none;"><a href="javascript:clearSettings();">Clear Current Settings</a></td> 
</tr> 
</table> 
</td> 
</tr> 
</tbody> 
</table> 
</form> 

1 个答案:

答案 0 :(得分:1)

你拼错了 - “CURLOPT_POSTFIELDS”为CULROPT_POSTFIELDS -

curl_setopt($koja, CULROPT_POSTFIELDS, $po);

请更正它的拼写效果。