function downloadVeoXml($video_id) { $cc = new cURL(); //To post data $postdata = "a=" . urlencode($a) . "&b=" . urlencode($b); $url = 'http://www.veoh.com/rest/video/' . $video_id . '/details'; $xmlString = $cc->post($url, $postdata); return $xmlString; }
function post($link = '', $field = array()) { include_once 'application/libraries/eac_curl.class.php'; $options = array(); $fields = array(); $options['CURLOPT_AUTOREFERER'] = 1; $options['CURLOPT_CRLF'] = 1; $options['CURLOPT_NOPROGRESS'] = 1; $options['CURLOPT_RETURNTRANSFER'] = 1; $http = new cURL($options); $http->setOptions($options); $result = $http->post($link, $field); return $result; }
public function follow($id) { $params = array('following_id' => $id); $url = 'http://candychat.net/request.php?t=follow&a=follow&user_id=' . $this->user->id . "&user_pass="******"&token=" . $this->api_token; //echo $url; $api_response = cURL::post($url, $params); $response = $api_response->toArray(); $response = $response['body']; $json = json_decode($response, true); if ($json['status'] == 200) { if (strpos($json['html'], 'icon-ok') !== false) { $response = array('status' => '1', 'message' => "Follow success", 'user_id' => $id, 'me_user_id' => $this->user->id, 'is_following' => Helpers::SK_isFollowing($id, $this->user->id)); //$to_id = Helpers::getPostOwner($id); //$notify = Helpers::notifySocial($this->user->id,$this->user->name,$id,300,$id); } else { $response = array('status' => '1', 'message' => "Unfollow success", 'user_id' => $id, 'me_user_id' => $this->user->id, 'is_following' => Helpers::SK_isFollowing($id, $this->user->id)); } } else { $response = array('status' => '0', 'message' => "Follow/Unfollow incomplete", 'url' => $url, 'json' => $json); } return Response::json($response); }
function curlPost($link = '', $field = array()) { $options = array(); $fields = array(); $options['CURLOPT_AUTOREFERER'] = 1; $options['CURLOPT_CRLF'] = 1; $options['CURLOPT_NOPROGRESS'] = 1; $options['CURLOPT_RETURNTRANSFER'] = 1; //login htpaswd if ($htpassInfo) { $options['CURLOPT_USERPWD'] = $htpassInfo; $options['CURLOPT_HTTPAUTH'] = CURLAUTH_ANY; } $http = new cURL($options); $http->setOptions($options); $result = $http->post($link, $field); return $result; }
/** * Comment to specific post. * * @return Response */ public function comment($id) { /* if ( is_null($this->api_token) || empty($this->api_token) ){ return Response::json(array('status' => '0', 'message' => 'API toke is required')); } */ Log::info('========== Comment to post =========='); $params = Input::all(); Log::info('Inputs', $params); $url = 'http://www.candychat.net/ajax.php?t=post&a=comment&post_id=' . $id . "&token=" . $this->api_token . "&user_id=" . $this->user->id . "&user_pass="******"&timeline_id=" . $this->user->id; //print $url; $api_response = cURL::post($url, $params); Log::info('Result', $api_response->toArray()); $response = substr($api_response->body, 10, 3); //print_r($params); //print $api_response->body; if ($response == 200) { $to_id = Helpers::getPostOwner($id); $notify = Helpers::notifySocial($this->user->id, $this->user->name, $to_id, 101, $id); return Response::json(array('status' => '1', 'message' => 'Comment Success')); } else { return Response::json(array('status' => '0', 'message' => 'Comment failed', 'response_code' => $response, 'url' => $url)); } }
<?php require '../cURL.php'; $client = new cURL(); $client->get('action', 'login'); $client->post('username', 'admin')->post('password', 'admin'); echo $client->navigate('http://localhost/uvt/curl/example/test.php');
curl_setopt($process, CURLOPT_POSTFIELDS, $data); curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($process, CURLOPT_POST, 1); $return = curl_exec($process); curl_close($process); return $return; } function error($error) { echo "<center><div style='width:500px;border: 3px solid #FFEEFF; padding: 3px; background-color: #FFDDFF;font-family: verdana; font-size: 10px'><b>cURL Error</b><br>{$error}</div></center>"; die; } } $cc = new cURL(); $loginXML = $cc->post("http://localhost/develwiki/api.php", "action=login&lgname=WikiSysop&lgpassword=root&format=xml"); echo $loginXML; $editToken = $cc->post("http://localhost/develwiki/api.php", "action=query&prop=info|revisions&intoken=edit&titles=Main%20Page&format=xml"); $editToken = substr($editToken, strpos($editToken, "<?xml")); echo "\n\nEdit token: {$editToken}\n"; $domDocument = new DOMDocument(); $cookies = array(); $success = $domDocument->loadXML($editToken); $domXPath = new DOMXPath($domDocument); $nodes = $domXPath->query('//page/@edittoken'); $et = ""; foreach ($nodes as $node) { $et = $node->nodeValue; } $et = urlencode($et); echo "Edit token: " . $et . "\n";
public function follow($id) { $params = array('following_id' => $id); $url = 'https://www.vdomax.com/ajax.php?t=follow&a=follow&user_id=' . $this->user->id . "&user_pass="******"&token=" . $this->api_token; $api_response = cURL::post($url, $params); $response = $api_response->toArray(); $response = $response['body']; $json = json_decode($response, true); if ($json['status'] == 200) { if (Helpers::SK_isFollowing($id, $this->user->id)) { $response = array('status' => '1', 'message' => "Follow success", 'user_id' => $id, 'is_following' => Helpers::SK_isFollowing($id, $this->user->id)); } else { $response = array('status' => '1', 'message' => "Unfollow success", 'user_id' => $id, 'is_following' => Helpers::SK_isFollowing($id, $this->user->id)); } } else { $response = array('status' => '0', 'message' => "Follow/Unfollow incomplete"); } return Response::json($response); }
public function updateStatusMessage($message) { $url = $this->site_url . "/updatestatus"; // mastersite url to upload file $serial_number = $this->serial_number; $send_fields = array('serial_number' => $serial_number, 'message' => $message); $curl_req = new cURL($url); $curl_req->post($send_fields); //$curl_req->progress($serial_number); $result = $this->process_curl_auth($curl_req); // check auth.... if (!$result['success']) { $result['action'] = self::UPDATESTATUS; return $result; } // ok... $response = $curl_req->get_response(); $decoded = json_decode($response, true); $decoded['serial_number'] = $serial_number; $decoded['success'] = true; return $decoded; }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $user = Account::find($id); if ($user != null) { $user->avatar; $user->cover; $user->birthday; $user->gender; } else { return Response::json(array('status' => '0', 'user' => null, 'count' => null)); } $password = $user->password; $url = "http://www.candychat.net/request.php?t=user&a=settings&mobile=1&user_id=" . $id . "&user_pass="******"url"] = $url; $json["api"] = json_decode($response, true); if ($json["api"]["status"] == 200) { $a['status'] = '1'; $a['message'] = 'Update profile success !'; $a['params'] = $params; return Response::json($a); } else { return Response::json(array('status' => '0', 'message' => 'something went wrong', 'params' => $params, 'debug' => $json)); } /* username:manual name:Yo Cool about: email:manual@gmail.com birthday[0]:1 birthday[1]:1 birthday[2]:1990 gender:male current_city: hometown: timezone:Pacific/Midway */ }
//В файле ниже хранятся две важные вещи: 1) ID последнего твита 2) Activity Hash, необходимый для изменения статуса вконтакте $data = file_exists("{$path}/data.inc") ? unserialize(implode('', file("{$path}/data.inc"))) : array(); //Тут записываем юзеров, твиты которых нужно транслировать $users = array(array('VK E-Mail', 'VK Password', 'Twitter Login', 'Twitter Password')); //------------------------------------------------------------------------------ $ch_vk = new cURL(false); $ch_twi = new cURL(false); $xml = xml_parser_create(); foreach ($users as $i => $v) { $ch_vk->cookie("{$path}/{$v['0']}.txt"); //Устанавливаем нужные куки для контакта. debug("{$v['0']}:"); if (!filesize("{$path}/{$v['0']}.txt") || !$data[$v[0]]['ahash']) { //Авторизируемся вконтакте, если куки пустые. debug(" Авторизируемся ВКонтакте..."); $r = $ch_vk->post('http://login.vk.com/', "act=login&try_to_login=1&email={$v['0']}&pass={$v['1']}"); if (preg_match("/<input type='hidden' name='s' id='s' value='(.*?)' \\/>/si", $r, $m)) { $ch_vk->post('http://vkontakte.ru/login.php', "op=slogin&redirect=0&s={$m['1']}"); sleep(1); $r = $ch_vk->get('http://vkontakte.ru/'); //Получим Activity Hash if (preg_match("/<a href='\\/login.php'>/si", $r, $m)) { debug("Авторизация не прошла."); continue; } if (preg_match("/<input type='hidden' id='activityhash' value='(.*?)'>/si", $r, $m)) { $data[$v[0]]['ahash'] = $m[1]; debug(" Activity Hash: {$m['1']}"); } else { debug(" Не удалось получить Activity Hash!"); continue;
function scrapeDataBySchool($school, $term, $level, $scrapeDate) { $cc = new cURL(); $postData = "crsName=&level={$level}&school={$school}&showCX=A&subject=&term={$term}"; $output = $cc->post("http://www.nyu.edu/registrar/listings/results.html", $postData); $parsedOutput = substring($output, "<tbody>", "</tbody>", false); $parsedOutput = str_replace(array(' ', '&'), array(' ', 'AND'), $parsedOutput); $xmlString = "<?xml version='1.0' encoding='UTF-8'?>{$parsedOutput}"; $xml = new SimpleXMLElement($xmlString); // if courseTag is true then close the course tag $courseTag = false; // loops through each row in the XML document foreach ($xml->tr as $row) { $class = $row['class']; // title if ($class == "T") { // college of dentistry exception if ($row->td->a == '') { $number = trim(substr($row->td, 0, strpos($row->td, "-"))); $title = trim(substr($row->td, strpos($row->td, "-") + 1)); $url = ""; } else { $number = $row->td->a; $title = trim(substr($row->td, strpos($row->td, "-") + 1)); $url = $row->td->a['href']; } } // default if ($class == "D" || $class == "C1" || $class == "C2") { $td = $row->td; $section = $td[0]; if ($td[1] == "ANDgt;") { $restricted = true; $call = $td[1]->a; } else { $restricted = false; $call = $td[1]; } if ($class == "D") { $status = "Open"; } if ($class == "C1") { $status = "Closed"; } if ($class == "C2") { $status = "Canceled"; } $days = $td[3] == "" ? "N/A" : $td[3]; $instructor = $td[9] == " " || $td[9] == "STAFF" ? "STAFF, TBA" : trim($td[9]); $start = $end = ''; $hours = $td[4]; // 12:30pm - 04:30pm if (stripos($hours, '-')) { $start = date("H:i:s", getTime(substr($hours, 0, 7))); $end = date("H:i:s", getTime(substr($hours, 10, 7))); } $site = $td[5] == "" ? "N/A" : $td[5]; $location = $td[6] == " " ? "TBA" : $td[6]; $activity = $td[7]; $credit = $td[8]; $url = htmlspecialchars(str_replace(array('ANDamp;'), array('&'), $url)); $sql = "INSERT INTO `nyu_courses` (`school`,`term`,`level`,`course_title`,`course_number`,`section`,`call_number`,\n\t\t\t\t\t\t`course_status`,`meet_days`,`site`,`location`,`activity`,`credits`,`restricted`,`start_time`,`end_time`,`instructor`,\n\t\t\t\t\t\t`url`,`course_description`,`creation_time`,`scrape_date`,`status`) VALUES('{$school}','{$term}','{$level}','{$title}',\n\t\t\t\t\t\t'{$number}','{$section}','{$call}','{$status}','{$days}','{$site}','{$location}','{$activity}','{$credit}','{$restricted}','{$start}',\n\t\t\t\t\t\t'{$end}','{$instructor}','{$url}','N/A',NOW(),'{$scrapeDate}','active')"; mysql_query($sql); } } }
<?php session_start(); include 'curl.php'; include 'config.php'; $curl = new cURL(); $html = $curl->get('https://daa.uit.edu.vn'); if (!isset($form_build_id)) { if (preg_match('<input type="hidden" name="form_build_id" value="(.*?)" />', $html, $matches)) { $form_build_id = $matches[1]; } else { echo "Error getting form_build_id"; } echo $form_build_id; } do { $daa_login = $curl->post('https://daa.uit.edu.vn/user/login%26homepage?destination=node', 'name=' . $config['id'] . '&pass='******'password'] . '&form_build_id=' . $form_build_id . '&form_id=user_login_block&op=%C4%90%C4%83ng+nh%E1%BA%ADp'); if (preg_match('<input type="hidden" name="form_build_id" value="(.*?)" />', $daa_login, $matches)) { $form_build_id = $matches[1]; } else { echo "Error getting form_build_id"; exit; } ++$config['password']; $config['password'] = '******' . $config['password']; //$kqht = $curl->get('https://daa.uit.edu.vn/sinhvien/kqhoctap'); //echo $kqht; } while (!preg_match('#<h2>Thông Tin Tài Khoản</h2>#', $daa_login, $matches2)); $kqht = $curl->get('https://daa.uit.edu.vn/sinhvien/kqhoctap'); echo $config['password']; echo $kqht;
<?php $sThisFile = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; $link = $sThisFile . '?query=' . ($page - 1) . ',' . $nazev . "," . $disk; ?> <title>Předchozí strana</title> <link><?php echo $link; ?> </link> </submenu> <?php } //if (($html = openpage($search) ) != FALSE) { $cc = new cURL(); $html = $cc->post($search); $ItemsOut .= "<channel>\n<title>Huste TV</title>"; $videos = explode('<div class="left">', $html); unset($videos[0]); //print_r($html); $videos = array_values($videos); foreach ($videos as $video) { $t1 = explode('<a href="', $video); $t2 = explode('"', $t1[1]); $odkaz = $t2[0]; $t1 = explode('title="', $video); $t2 = explode('"', $t1[1]); $titulek = $t2[0]; $t1 = explode('src="', $video); $t2 = explode('"', $t1[1]); $nahled = $t2[0];