Jump to content

1zeus1

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by 1zeus1

  1. I need to download only pages that belong to the domain gorgeoussales.com I tried using: wget -k --max-redirect=3 --tries=3 --domains=gorgeoussales.com -O /var/www/b.html http://gorgeoussales.com/22530 But the problem is that it is also downloaded external sites watchshop.com/ Any hints? Regards
  2. I'm attempting to send post data through wget using the --post-data parameter, and I'm sure it's right, but it's simply not working. I'm using --post-data like this: wget --post-data 'first_name=test' http://www.testtest.com/test.php What am I doing wrong?
  3. Hello, I need you to this page kijiji.it, it does not download immediately, however will download immediately without a break: I do not understand, why not work: --wait=100 --random-wait wget --wait=100 --random-wait --user-agent="Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0" -b -k --html-extension --convert-links --max-redirect=10 --tries=0 -O /var/www//a.html www.kijiji.it
  4. I need to function for convert hex color, in HSL color with php example: hex: #ab9226 to hsl(48,64%,41%) regards
  5. I would make sure that this works, every 30 seconds: : seq 100 | parallel -N0 -j 2 php /usr/share/nginx/html/siti.php I tried it, so just do not work: seq 100 watch -n 30 | parallel -N0 -j 2 php /usr/share/nginx/html/siti.php Could anyone please help?
  6. I would like to run these: screen watch -n 0 php /usr/share/nginx/html/2siti.php & screen watch -n 0 php /usr/share/nginx/html/2siti.php & screen watch -n 0 php /usr/share/nginx/html/2siti.php & screen watch -n 0 php /usr/share/nginx/html/2siti.php & screen watch -n 0 php /usr/share/nginx/html/2siti.php & screen watch -n 0 php /usr/share/nginx/html/2siti.php in parallel using GNU parallel ? I have 2 cores Could anyone please help?
  7. I can not, to make this code Someone can help me Regards
  8. How can I delete duplicate in $data? $data = array(); foreach ($get->find('h3[class=r] a') as $e) { //---// $data[] = "$var1,$var2"; } $file = "/var/www/html/top; $Handle = fopen($file, 'a') or die("Unable to open file!"); fwrite($Handle, implode("\n", $data)); fclose($Handle); I tried this, but it does not work $data = array(); foreach ($get->find('h3[class=r] a') as $e) { //---// $data[] = array_unique($var1,$var2); } $file = "/var/www/html/top; $Handle = fopen($file, 'a') or die("Unable to open file!"); fwrite($Handle, implode("\n", $data)); fclose($Handle); Regards.
  9. Hello I want multiple inserts into a table Without an index, insert works If you created a unique index, the insert does not work $values = array(); foreach ($get->find('h3[class=r] a') as $e) { $sit = strtolower($e -> href); $values[] = "('$sit')"; } mysql_query('INSERT INTO xsit (var) VALUES '.implode(',', $values)); thanks for your help
  10. .htaccess RewriteEngine On RewriteRule ^sito/(.*)$ sito/index.php?q=$1 ////////////////////////////////////////////////////////////////// or this error in localhost Error 404 Object not found! The requested URL was not found on this server.
  11. Hello This is a problem I encountered when Im trying to convert my dynamic url to friendly url. I have a URL like this localhost/a /sito/index.php?q=hello I need to rewrite it like this localhost/a /sito/hello regards
  12. solved, thanks Gurus $html = str_get_html('<span class="st">svsv</span>');
  13. or this error : Fatal error: Call to a member function find() on a non-object in C:\xampp\htdocs\b\a\v.php on line 6 in this code: <?php include('simple_html_dom.php'); $html = '<span class="st">svsv</span>'; ///////////////////////// foreach($html->find('span.st') as $c) $cc= $c -> plaintext . '-'; ?> can someone help me regards
  14. Hey Guys i'm trying to figure out how to find a specific tag and grab the content between it. <body> <h1>Hello PHP Freaks!</h1> <table> <tr class="ad"> <td> <a class="a1" href="aaa.php></a> </td> </tr> <tr class="ad"> <td> <a class="a1" href="bbb.php></a> </td> </tr> </table> </body> </html> Result: aaa.php bbb.php regards
  15. 1zeus1

    update

    or need to run this code on the server every 4 to 5 s without opening the page in browser <?php $con = mysql_connect("*","*","*"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("*", $con); $result = mysql_query("SELECT * FROM `ta` WHERE `top` LIKE '0' LIMIT 0,1"); $row_ro = mysql_fetch_array($result); $a = $row_ro['id']; $query="UPDATE tr SET top = '1' WHERE id = '$a'"; mysql_query($query); mysql_close($con); ?> regards
  16. or need to extract all tags <p> from a site in Italian //////////////////////////////////////////////////////////////////////// header('Content-Type: text/html; charset=iso-8859-1'); function curl_file_get_contents($url) { $curl = curl_init(); $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)'; curl_setopt($curl,CURLOPT_URL,$url); //The URL to fetch. This can also be set when initializing a session with curl_init(). curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE); //TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly. curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,10); //The number of seconds to wait while trying to connect. curl_setopt($curl, CURLOPT_USERAGENT, $userAgent); //The contents of the "User-Agent: " header to be used in a HTTP request. curl_setopt($curl, CURLOPT_FAILONERROR, TRUE); //To fail silently if the HTTP code returned is greater than or equal to 400. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE); //To follow any "Location: " header that the server sends as part of the HTTP header. curl_setopt($curl, CURLOPT_AUTOREFERER, TRUE); //To automatically set the Referer: field in requests where it follows a Location: redirect. curl_setopt($curl, CURLOPT_TIMEOUT, 5); //The maximum number of seconds to allow cURL functions to execute. $contents = curl_exec($curl); curl_close($curl); return $contents; } $get = curl_file_get_contents($url); function getTextBetweenTags($tag, $html, $strict=0) { /*** a new dom object ***/ $dom = new domDocument; /*** load the html into the object ***/ if($strict==1) { $dom->loadXML($html); } else { $dom->loadHTML($html); } /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** the tag by its tag name ***/ $content = $dom->getElementsByTagname($tag); /*** the array to return ***/ $out = array(); foreach ($content as $item) { /*** add node value to the out array ***/ $out[] = $item->nodeValue; } /*** return the results ***/ return $out; } <?php $content = getTextBetweenTags1('p', $html); foreach( $content as $item ) { echo $item.'.'; } ?> ///////////////////////////////////////////////////////////////////////////////// My problem is that it does not recognize accented characters./// //////////////////////////////////////////////////////////////////////////////// "con un certo miglioramento del testo e, cosa più importante, con le firme dei sottoscrittori. scusate la ripetizione. che però, dicevano gli antichi, iuvat. un caro saluto. " Or need your help regards,cristian
  17. 1zeus1

    extract

    or need to extract all h1 tags and insert into database You can modify this code to make it work? ////////////////////////////////////////////////////////////////// function getTextBetweenTags($tag, $get, $strict=0) { /*** a new dom object ***/ $dom = new domDocument; /*** load the html into the object ***/ if($strict==1) { $dom->loadXML($get); } else { $dom->loadHTML($get); } /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** the tag by its tag name ***/ $content = $dom->getElementsByTagname($tag); /*** the array to return ***/ $out = array(); foreach ($content as $item) { /*** add node value to the out array ***/ $out[] = $item->nodeValue; } /*** return the results ***/ return $out; } $content = getTextBetweenTags('h1', $get); foreach( $content as $item ) { $h1 = $item.'<br />'; } $query="UPDATE sitis SET hh = '$h1' WHERE id = '$a'"; //My problem and that puts only a h1 regards
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.