Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is a generic class i have written to make the curl use easy. first save this to a file some where. </p> <pre><code> &lt;?php class curling { private $_ch = NULL; private $_file = NULL; private $_html = NULL; private $_cookiejar = NULL; public function __construct() { $this-&gt;init(); } private function init() { $this-&gt;_ch = curl_init(); curl_setopt($this-&gt;_ch, CURLOPT_VERBOSE, 0); curl_setopt($this-&gt;_ch, CURLOPT_HEADER, 0); curl_setopt($this-&gt;_ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this-&gt;_ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($this-&gt;_ch, CURLOPT_TIMEOUT,1000); curl_setopt($this-&gt;_ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($this-&gt;_ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($this-&gt;_ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); } /** * * Enter description here ... * @param unknown_type $res * @param unknown_type $data */ private function write($res, $data) { $this-&gt;_html .= $data; return strlen($data); } /** * * Enter description here ... * @param unknown_type $url */ function get_page($url) { if ($this-&gt;ch == NULL) $this-&gt;init(); curl_setopt($this-&gt;_ch, CURLOPT_URL, $url); curl_setopt($this-&gt;_ch, CURLOPT_CONNECTTIMEOUT, 5); $this-&gt;_html = curl_exec($this-&gt;_ch); if (curl_errno($this-&gt;_ch) !== 0) { throw new Exception("unable to retrive content", 100); } curl_close($this-&gt;_ch); return $this-&gt;_html; } /** * * Enter description here ... * @param unknown_type $url * @param unknown_type $data */ function post_page($url, $data) { if ($this-&gt;ch == NULL) $this-&gt;init(); curl_setopt($this-&gt;_ch, CURLOPT_URL, $url); curl_setopt($this-&gt;_ch, CURLOPT_POST, true); curl_setopt($this-&gt;_ch, CURLOPT_POSTFIELDS, http_build_query($data)); $this-&gt;_html = curl_exec($this-&gt;_ch); //curl_close($this-&gt;_ch); return $this-&gt;_html; } function close_session() { curl_close($this-&gt;_ch); } } ?&gt; </code></pre> <p>Then comes your code. </p> <pre><code> &lt;?php require_once('curling.php'); libxml_use_internal_errors(true); $url = "http://www.putlocker.com/file/CB79E6201EDBA3ED"; $curl = new curling(); $output = $curl-&gt;get_page($url); //call your landing page url from here $dom_document = new DOMDocument(); $dom_document-&gt;loadHTML($output); $dom_xpath = new DOMXPath($dom_document); foreach($dom_xpath-&gt;query("//input[@name=\"hash\"]/@value") as $node) $hash=$node-&gt;textContent; $data = array('hash' =&gt; $hash, 'confirm' =&gt; 'Continue%20as%20Free%20User'); $output2 = $curl-&gt;post_page($url, $data); $curl-&gt;close_session(); echo $output2; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload