1 頁 (共 1 頁)

Curl 範例

發表於 : 2005-11-07 18:10:12
yehlu
Using Curl can I access the OpenSRS admin control panel (tucows)
http://www.alt-php-faq.org/local/106/

Processing Payments With CURL
http://www.phpfreaks.com/tutorials/49/0.php

用 curl 檢查連結是否存在

發表於 : 2005-11-07 18:17:33
yehlu
http://blog.unitedheroes.net/curl/

<?php

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

if (empty($buffer))
{
print "Sorry, example.com are a bunch of poopy-heads.<p>";
}
else
{
print $buffer;
}
?>

登入qq

發表於 : 2005-11-08 00:09:37
yehlu
http://if.ustc.edu.cn/~ygwu/blog/archives/000722.html

<php
$qq = "100000"; //qq号码
$pwd = "123456"; //密码

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://211.139.167.71/waptest/TWF/qqpor ... erinfo.jsp");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //这行是设定curl是否跟随header发送的location, 重要
curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, "Connection", "Keep-Alive");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "qq=".$qq."&pwd=".$pwd."&FromWhere=register");

$return = curl_exec($ch);

curl_close($ch);

echo strstr($return, "postfield") ? "登录失败" : "登录成功";
?>

yahoo bid

發表於 : 2005-11-08 00:28:20
yehlu
<?
$id = "yahoo_id";
$pw = "yahoo_pw";
$LOGINURL = "https://edit.tpe.yahoo.com/config/login?bqsjo61g56sg4";
$GETURL = "http://tw.user.bid.yahoo.com/tw/show/myaucs";
$POSTFIELDS = "login=$id&passwd=$pw";
$user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";

function AUTH_SITE_COOKIE_STORE($LOGINURL, $POSTFIELDS) {
global $id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "$id.cookie");
curl_setopt($ch, CURLOPT_URL, "$LOGINURL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$POSTFIELDS");
curl_exec($ch);
curl_close ($ch);
return "$id.cookie";
}

function AUTH_SITE_GET($GETURL, $cookieFile) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "$cookieFile");
curl_setopt($ch, CURLOPT_URL, "$GETURL");
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
$result = curl_exec($ch);
curl_close ($ch);
return $result;
}

$cookieFile = "$id.cookie";
$result = AUTH_SITE_GET($GETURL, $cookieFile);
if($result == 1) {
if(file_exists($cookieFile)) unlink($cookieFile);
$cookieFile = AUTH_SITE_COOKIE_STORE($LOGINURL, $POSTFIELDS);
$result = AUTH_SITE_GET($GETURL, $cookieFile);
}
echo $result;
?>

如何用php&#20266;造referer

發表於 : 2005-11-08 17:48:01
yehlu
http://www.phpx.com/happy/showthread.ph ... light=curl

<?php
error_reporting( E_ERROR | E_WARNING | E_PARSE );
set_time_limit(0);


$server = 'www.ttxx.com'; // IP address
$host = 'www.ttxx.com'; // Domain name
$target = '/download.asp?id=5179&downid=3'; // Specific program
$referer = 'http://www.ttxx.com/Software/Catalog84/5079.html'; // Referer
$port = 80;



$fp = fsockopen($server, $port, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
$out = "GET $target HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Cookie: ASPSESSIONIDSQTBQSDA=DFCAPKLBBFICDAFMHNKIGKEG\r\n";
$out .= "Referer: $referer\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
?>

HTTP&#21327;&#35758;&#23398;&#20064;&#36

發表於 : 2005-11-08 17:58:58
yehlu