public function setCookieFile($file) { $this->curl->setCookieFile($file); return $this; }
<?php require_once '../src/Curl.php'; $curl = new Curl(); $result = $curl->setCookieFile()->sendCookieData(['chave' => 'valor'])->get('http://httpbin.org/cookies'); var_dump($result);
<?php set_time_limit(0); require_once "../curl.class.php"; $hn_user = ""; $hn_pass = ""; $curl = new Curl(); $curl->setSsl(); $curl->setCookieFile("cookie.txt"); libxml_use_internal_errors(true); $page = $curl->get("https://news.ycombinator.com/newslogin?whence=news"); $dom = new DOMDocument(); $dom->loadHTML($page); $fnid = false; $inputs = $dom->getElementsByTagName('input'); for ($i = 0; $i < $inputs->length; $i++) { if ($inputs->item($i)->getAttribute("name") == "fnid") { $fnid = $inputs->item($i)->getAttribute("value"); break; } } if (!$fnid) { print "can't find fnid\n"; exit; } $data = array("fnid" => $fnid, "u" => $hn_user, "p" => $hn_pass); $page = $curl->post("https://news.ycombinator.com/y", $data); print $page;
$id = false; } if (!$id) { $return = array("status" => 99); print json_encode($return); exit; } require_once "../../vars.php"; require_once "../../includes/curl.php"; require_once "../../includes/show.class.php"; require_once "../../includes/settings.class.php"; require_once "../../includes/tvlinks.class.php"; $settings = new Settings(); $shows = new Show(); $curl = new Curl(); $curl->setCookieFile($basepath . "/cachefiles/tvlinkscookie.txt"); $tv = new TVlinks($curl); sleep(2); $return = array(); if (isset($id) && $id && is_numeric($id)) { $show = $shows->getEpisodeById($id, "en"); if (count($show)) { $sr = $settings->getSetting("tvlinks"); if ($tv->login($sr->username, $sr->password)) { $url = $baseurl . $show['url']; $link = $tv->submit($show['showtitle'], $show['season'], $show['episode'], $url); if ($link) { $shows->addSubmit($id, 7, $link); $return['status'] = 1; $return['link'] = $link; } else {