hadimostafavi
New Member
سلام من یه فرم دارم که کدش اینه
یجا خوندم با curl نمیشه اینکار رو انجام داد اگه با همین curl بشه که چه عالی ولی اگه نه ممنون میشم راه حل دیگری بفرمایید اگه نمونه کد بذارید یدنیا ممنون میشم.
[HTMLS]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>">
<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<form action="tres.php" method="post">
<font face="Verdana" size="0">Usename: </font>
<input id="Text1" type="text" name="txtEmail" /><br />
<font face="Verdana" size="0">Password: </font>
<input id="Text2" type="password" name="txtPassword" /><br />
<br />
<input id="submit" type="submit" name="submit1">
<body>
</body>
</html>[/HTMLS]
و کد فایل tres.php هم<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<form action="tres.php" method="post">
<font face="Verdana" size="0">Usename: </font>
<input id="Text1" type="text" name="txtEmail" /><br />
<font face="Verdana" size="0">Password: </font>
<input id="Text2" type="password" name="txtPassword" /><br />
<br />
<input id="submit" type="submit" name="submit1">
<body>
</body>
</html>[/HTMLS]
[PHPS]<?php
echo $_POST["txtEmail"];
echo $_POST["txtPassword"];
?>[/PHPS]
و کدی که اقدام به پر کردن فیلدها میکنمecho $_POST["txtEmail"];
echo $_POST["txtPassword"];
?>[/PHPS]
[PHPS]<?php
//create the final string to be posted using implode()
$post_string = 'txtEmail=1&txtPassword=2';
//create cURL connection
$curl_connection =
curl_init('127.0.0.1/projects/Form.html');
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, true);
//set data to be posted
curl_setopt($curl_connection,CURLOPT_POST, 2);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($curl_connection);
//show information regarding the request
echo $result;
//close the connection
curl_close($curl_connection);
?>[/PHPS]
ولی به هیچ وجه عمل لوگین انجام نمیشه echo result رو هم برداشتم و تست کردم فایده نداشت میشه میشه کمک کنید و بگین مشکل از کجاست ممنون میشم//create the final string to be posted using implode()
$post_string = 'txtEmail=1&txtPassword=2';
//create cURL connection
$curl_connection =
curl_init('127.0.0.1/projects/Form.html');
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, true);
//set data to be posted
curl_setopt($curl_connection,CURLOPT_POST, 2);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($curl_connection);
//show information regarding the request
echo $result;
//close the connection
curl_close($curl_connection);
?>[/PHPS]
یجا خوندم با curl نمیشه اینکار رو انجام داد اگه با همین curl بشه که چه عالی ولی اگه نه ممنون میشم راه حل دیگری بفرمایید اگه نمونه کد بذارید یدنیا ممنون میشم.
آخرین ویرایش: