note 53765 added to ref.curl

From: Date: Sun, 12 Jun 2005 16:14:42 +0000
Subject: note 53765 added to ref.curl
Groups: php.notes 
Request: Send a blank email to php-notes+get-90305@lists.php.net to get a copy of this message
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! ---- Manual Page -- http://www.php.net/manual/en/ref.curl.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53765 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53765&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53765&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53765&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53765&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53765&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53765&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90305) next »