2011-09-20 80 views
3

我在發佈URL表單時遇到問題。當我運行cURL時,它看起來像進入了一個無限循環;它不會停下來。這是確定的,當我做簡單的形式,如:爲什麼cURL會進入無限循環?

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

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

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

</form> 

但是,當我嘗試提交一個phpBB3的論壇腳本,其中也有一些類似的形式後,該腳本不會停止。

我是否必須確定每個輸入的變量,即使有2個表單,我只想提交其中的一個?

捲曲代碼:

<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> 
+6

請發佈您的整個代碼,有任何數量的方法來創建一個無限循環。 –

+2

我認爲這是因爲「CURLOPT_RETURNTRANSFER」。如果您不想自動傳輸,您應該將其設置爲false。 – benck

+0

@benck'CURLOPT_RETURNTRANSFER'用於返回他們請求的頁面的主體,它不會導致無限循環。 –

回答

1

你有拼寫錯誤 - 「CURLOPT_POSTFIELDS」 作爲CULROPT_POSTFIELDS一致 -

curl_setopt($koja, CULROPT_POSTFIELDS, $po); 

請更正它將起作用的拼寫。