我从Curl / php开始,我真的很享受它能做的事情。虽然,我有几天的时间被阻止了,我真的需要帮助。
多亏了txt文件,我需要用另一个脚本抓取和处理一些特殊的数据。
这些数据是由一位成员在我的论坛上发布的代理,并同意在与论坛相关的外部网站上发布。
代理位于此表单下
107.2.178.129:47535<br/>173.174.251.89:18785<br/>173.48.224.237:1807<br/>and so on ... 我需要将它们放在一个文本文件中,每行一个代理。
这是我到目前为止所掌握的
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.external-site.com/Members/Login.php');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS,
'fieldname1=fieldvalue1&fieldname2=fieldvalue2');
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_setopt($ch, CURLOPT_URL,
'http://www.external-site.com/index.cgi?action=display&thread=26');
$content = curl_exec ($ch);
curl_close ($ch);
?>在那之后我就卡住了。
发布于 2011-09-25 10:24:10
你收到论坛的帖子了吗?假设$content有效:
file_put_contents('proxies.txt', implode('\n', explode('<br/>', $content)));在Linux上使用\n,在Windows上使用\r\n。
https://stackoverflow.com/questions/7543214
复制相似问题