note 53765 rejected from ref.curl by mazzanet
| From: | mazzanet@php.net | Date: | Sun, 12 Jun 2005 22:28:37 +0000 |
| Subject: | note 53765 rejected from ref.curl by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90323@lists.php.net to get a copy of this message | ||
Note Submitter: asv2001 at yandex dot ru
----
I wanted to post a record to the one diary-site.. This site requires authorization. Here is the
script:
<?
$curl_res_id = curl_init("http://journals.ru/member.php"); //auth script
$postData = array(); //Data to post
$postData["action"] = "login"; //action
$postData["username"] = "your login"; //login
$postData["password"] = "your password"; //password
curl_setopt($curl_res_id, CURLOPT_RETURNTRANSFER, 1); //don't output anything
curl_setopt($curl_res_id, CURLOPT_COOKIEJAR, "/tmp/journals.cookie"); //where to write
cookie recieved from server
curl_setopt($curl_res_id, CURLOPT_POSTFIELDS, $postData); //Post data
curl_exec($curl_res_id); //run query
$postData = array();
$postData["action"] = "dopost";
$postData["userid"] = "18425";
$postData["title"] = "Title";
$postData["message"] = "message";
$postData["usermood_new"] = "my_mood";
$postData["music_new"] = "music_new";
$postData["parseurl"] = "yes";
$postData["subnewcom"] = "yes";
$postData["privatepost"] = "";
$curl_res_id = curl_init("http://journals.ru/newpost.php"); // script
that creates a post
curl_setopt($curl_res_id, CURLOPT_COOKIEFILE, "/tmp/journals.cookie"); //Sends cookies to
server
curl_setopt($curl_res_id, CURLOPT_POSTFIELDS, $postData); //Data
curl_setopt($curl_res_id, CURLOPT_RETURNTRANSFER, 1);//don't output anything
curl_exec($curl_res_id);//run query
?>
Sorry for my English :) Good luck!