0

I scraped a website using the simple DOM php parser :

<?php
include 'domparse.php';
$html = file_get_html('http://oceanofgames.com/rebel-galaxy-free-download/');
foreach($html->find('form[action="http://oceanofgames.com/Cloud-VPS-Download.php"]') as $element) 
echo $element;
?>

And I ended up with something like :

<form action="http://oceanofgames.com/Cloud-VPS-Download.php" target="_blank" method="post">
  <input type="hidden" name="filename" value="Rebel_Galaxy.zip" /><br />
  <input type="hidden" name="filesize" value="2GB" /><br />
  <input type="hidden" name="id" value="85.25.103.44" /></p>
  <div align="center">
    <input type="image" alt="Download" height="99" src="http://oceanofgames.com/wp-content/uploads/2013/09/button-download.png" width="184" />
  </div>
</form>

I need to make a POST server to the server using these credentials of the form using cURL and I have no idea how to do it. Please guide me.

Mowzer
  • 2,179
  • 3
  • 18
  • 28
  • http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request – barlop Oct 24 '15 at 19:38
  • I think maybe something like `curl --data "filename=Rebel_Galaxy.zip&filesize=2GB&id=85.25" https://example.com/resource` – barlop Oct 24 '15 at 19:40
  • I need to scrape a lot of urls like that, how can I isolate each of the elements? You know, dynamically. – Sachin S Kamath Oct 25 '15 at 00:23
  • You really need to elaborate on scraping URLs and isolating elements. 'cos that line I gave you doesn't scrape a URL (it doesn't GET the URL, it doesn't then get any info from the response to a GET of the URL) It just does a POST which gives the names and values for each element so the server gets the data as if it had been inputted into the page,. If you are asking how can you GET a URL and load the names of every element into an array.. that's a question for stackoverflow, if it hasn't been asked yet. – barlop Oct 25 '15 at 10:51

0 Answers0