ここに私のコードです。 $ new_ch []に対して$ new_chを修正したいと思います。 curl_init()関数で実行可能ですか? curl_init()関数を使って配列を調べたいので、$ new_chごとに自動インクリメントの配列が必要です。返信して欲しい。ありがとう。配列変数としてPHPの関数curl_init()変数
$count = 0;
$judge = fopen($sourcefile,"r+");
while(!feof($judge))
{
$destination = fgets($judge);
$new_ch = curl_init();
curl_setopt($new_ch, CURLOPT_URL, $destination);
curl_setopt($new_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($new_ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($new_ch, CURLOPT_MAXREDIRS, 4);
curl_setopt($new_ch, CURLOPT_TIMEOUT, 30);
curl_setopt($new_ch, CURLOPT_USERAGENT, $agent_name);
curl_setopt($new_ch, CURLOPT_COOKIEFILE, $cookie_jar);
$getinner = curl_exec($new_ch);
$saveinner = fopen('./'.$datetime.'/'.$datetime.'.txt',"w+");
fwrite($saveinner,$getinner);
fclose($saveinner);
$dom_new = file_get_html('./'.$datetime.'/'.$datetime.'.txt');
foreach($dom_new->find('a') as $dom_new_element)
{
$needle_new = $dom_new_element->href;
$final_target = preg_match("/txt/",$needle_new);
$final_source = $site_rid.$needle_new."\n";
$mytrimaddress = parse_url($final_source, PHP_URL_QUERY);
$eachone = explode("&", $mytrimaddress);
$trimthename = trim($eachone[5]);
$lefttrim = ltrim($trimthename, "/");
$remaintrim = substr($lefttrim, 0, strlen($lefttrim)-1);
file_put_contents('./'.$datetime.'/'.$remaintrim, $final_source);
}
curl_close($new_ch);
$count++;
if($count > 5)
{
exit;
} else {
continue;
}
}
あなたの質問は不明で、理解しづらいです。 –
なぜあなたはそれを試してみませんか、それがうまくいかないときは、あなたの壊れたコードが戻ってきて表示されます。 –
こんにちは、 あなたが理解できる曖昧な部分はどこにありますか?私は変更したいと思います。 – jefferyear