Jump to content

Boxerman

Members
  • Posts

    275
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Boxerman's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

1

Community Answers

  1. Hey guys, Sorry to annoy you all with something so simple, but its truly causing hair to fall out (I'm running out as well!) The script below is the core of what im running, however, in the example below you can see array inside array, i've tried everything such as: $feed_to_array['entry'][0]['title]; This is literally confusing me intensely, all i want to do is grab title and content, that is all! Why am i so stupid! Thanks in advance all! <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); $feed = 'http://**deleting**?format=xml'; $feed_to_array = (array) simplexml_load_file($feed); //$feed_to_array = (array) new SimpleXmlElement( file_get_contents($feed) ); echo '<pre>'; print_r($feed_to_array); echo '</pre>'; ?> Output: Array ( [id] => tag:,2017:blog [title] => **removingURL** [link] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => https://www.**removingURL**.com/?mode=atom ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => license [type] => text/html [href] => http://creativecommons.org/licenses/by/2.0/ ) ) ) [icon] => http://bulk2.**removingURL**.com/ele2/images/**removingURL**/favicon.ico [updated] => 2017-03-09T20:30:00Z [logo] => http://creativecommons.org/images/public/somerights20.gif [entry] => Array ( [0] => SimpleXMLElement Object ( [id] => tag:https://www.**removingURL**.com/,2017:/post.phtml?pk=423974 [author] => SimpleXMLElement Object ( [name] => CJ Andriessen [uri] => http://www.****.com/blogs/CJ+Andriessen ) [title] => Nep nep nep nep nep nep nep this winter [link] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => http://feedproxy.google.com/~r/**removingURL**/~3/sPJh-Cxxbeg/nep-nep-nep-nep-nep-nep-nep-this-winter-423974.phtml ) ) [published] => 2017-03-09T20:30:00Z [updated] => 2017-03-09T20:30:00Z [content] => It has been several months since the last game in the Neptunia franchise hit western shores and something about that is just wrong. Usually, we’re drowning in releases, but it’s been barren since October’s crossover with the Sega Hard Girls franchise. Luckily, hope is on the horizon. Idea Factory International announced today Cyberdimension Neptunia: 4 Goddesses Online will release in North American and in the EU this winter. Coming to PS4 and Steam, Cyberdimension Neptunia features Neptune, Vert, Blanc, Noire and more teaming up to defeat the Demon King in the game-within-a-game known as 4 Goddesses Online. The title will feature 4 player co-op and online play. After watching the trailer below, I call dibs on my bae Nepgear. Nep nep nep nep nep nep nep this winter screenshot Read more... )
  2. Muddy! You da man! It's removed total, but still displaying the blank line at the bottom I'm missing something just not sure what!
  3. Thanks for the reply! however i'm getting the following error: Notice: Undefined offset: 0 Here is the entire foreach: foreach($servers as $server) { $connection = ssh2_connect($server['ip'], 22); if (ssh2_auth_password($connection, $server['user'], $server['pass'])) { $stream = ssh2_exec($connection, 'showvv -d'); stream_set_blocking($stream, true); //Set var for output to be stored in $data = ''; //loop the buffer and store output to $data while($buffer = fread($stream, 4096)) { $data .= $buffer; } //close the stream fclose($stream); //explode array to remove header $arr = explode("\n", $data); unset($arr[0]); // remove headings $fData = array(); $cnt = count($arr); for($i=0;$i<$cnt-1;$i++) { $items = sscanf($arr[$i], '%d %s %s'); echo $items[1] . '<br>'; $fData[$i][] = $items[1]; } var_dump($fData); } } Any suggestions?
  4. Sorry, the full output (i cut it down to save spamming repeats) but at the end of the list, there is a blank line and then the word total: admin name.boot name.0 name.1 name.boot name.boot name.boot name.boot name.boot evaluation evaluation.name.ro evaluation-NoChanges evaluation.name.ro total Also, my aim is to insert this into the database a new row for every line in the output. as you pass it to $items[1] wil that not just create one row with everything inside? Thanks again for your help!
  5. That works perfectly! thank you so much. One last thing, the output has the word "total" on the output the last time, is there a way to remove that and the black line above?
  6. Hey guys, So a short write of what i'm trying to do, i'm trying to SSH connect to a SAN to grab details about the virtual volumes on the SAN and display them on a page. The final aim is to have this run as a cron and inserted into MySQL. However, I have the script below with connects perfectly and displays the information i need, however, i am at a loss on how to actually break the output up into tables.. for example (the exact output): Id Name Rd Mstr Prnt Roch Rwch PPrnt PBlkRemain -----VV_WWN----- -----CreationTime------ 0 admin RW 2/3/1 --- --- --- --- -- 500name0405 2007-03-02 12:35:19 EST 1112 name.boot RW 2/3/1 --- --- --- --- -- 50002name0405 2012-02-24 16:54:48 EST 1113 name.0 RW 3/2/1 --- --- --- --- -- 5000name90405 2012-02-24 17:16:23 EST 1171 name.1 RW 1/3/2 --- --- --- --- -- 5000name405 2012-10-29 17:25:17 EDT 1306 name.boot RW 1/2/3 --- --- --- --- -- 50002name0405 2014-04-10 02:44:31 EDT 1307 name.boot RW 1/2/3 --- --- --- --- -- 5000name405 2014-04-10 08:49:09 EDT 1308 name.boot RW 1/2/3 --- --- --- --- -- 5000name0405 2014-04-10 08:50:00 EDT AS you can see it is currently display rows called ID, Name etc.. how would i echo only the Name's of the the volume? So the desired output is: admin name.boot name.0 name.1 name.boot name.boot name.boot Thanks so much for reading! hope you can help! Here is my script so far: <?PHP //Array in place as more SAN's to be connected so writing to prepare for future SAN's $servers = array( array('ip'=>'hostname','user'=>'username','pass'=>'password')); foreach($servers as $server) { $connection = ssh2_connect($server['ip'], 22); if (ssh2_auth_password($connection, $server['user'], $server['pass'])) { $stream = ssh2_exec($connection, 'showvv -d'); stream_set_blocking($stream, true); $data = ''; while($buffer = fread($stream, 4096)) { $data .= $buffer; } fclose($stream); echo '<pre>'.$data.'</pre>'; } } ?> Thanks again guys! you rock!
  7. Posted in wrong section, ever so sorry!
  8. Hey guys, So a short write of what i'm trying to do, i'm trying to SSH connect to a SAN to grab details about the virtual volumes on the SAN and display them on a page. The final aim is to have this run as a cron and inserted into MySQL. However, I have the script below with connects perfectly and displays the information i need, however, i am at a loss on how to actually break the output up into tables.. for example (the exact output): Id Name Rd Mstr Prnt Roch Rwch PPrnt PBlkRemain -----VV_WWN----- -----CreationTime------ 0 admin RW 2/3/1 --- --- --- --- -- 500name0405 2007-03-02 12:35:19 EST 1112 name.boot RW 2/3/1 --- --- --- --- -- 50002name0405 2012-02-24 16:54:48 EST 1113 name.0 RW 3/2/1 --- --- --- --- -- 5000name90405 2012-02-24 17:16:23 EST 1171 name.1 RW 1/3/2 --- --- --- --- -- 5000name405 2012-10-29 17:25:17 EDT 1306 name.boot RW 1/2/3 --- --- --- --- -- 50002name0405 2014-04-10 02:44:31 EDT 1307 name.boot RW 1/2/3 --- --- --- --- -- 5000name405 2014-04-10 08:49:09 EDT 1308 name.boot RW 1/2/3 --- --- --- --- -- 5000name0405 2014-04-10 08:50:00 EDT AS you can see it is currently display rows called ID, Name etc.. how would i echo only the Name's of the the volume? So the desired output is: admin name.boot name.0 name.1 name.boot name.boot name.boot Thanks so much for reading! hope you can help! Here is my script so far: <?PHP //Array in place as more SAN's to be connected so writing to prepare for future SAN's $servers = array( array('ip'=>'hostname','user'=>'username','pass'=>'password')); foreach($servers as $server) { $connection = ssh2_connect($server['ip'], 22); if (ssh2_auth_password($connection, $server['user'], $server['pass'])) { $stream = ssh2_exec($connection, 'showvv -d'); stream_set_blocking($stream, true); $data = ''; while($buffer = fread($stream, 4096)) { $data .= $buffer; } fclose($stream); echo '<pre>'.$data.'</pre>'; } } ?> Thanks again guys! you rock!
  9. Hi Notion, That's where im stuck, i'm struggling to trouble shoot it. I believe its the searching part of the search, however i can't be sure I'm so sorry i can't be helpful, i'm still learning this code, i'm just struggling to troubleshoot it.
  10. Hey guys, Sorry to waste your time here, but i'm hoping you can help. I'm really not sure how to ask for help here, but the below script basically runs off, checks a webpage for a page then returns results, however, if the title has more than 25 letters or has multiple spaces in like "I Am The One" it struggles to find it correctly. How would one attack such a problem? public function getTitle($title){ $title = trim($title); $title = stripslashes($title); $title = strtolower(urldecode($title)); $title = str_replace(" ","-",$title); $title = str_replace("'","'",$title); $title = str_replace(":",":",$title); return $title; } public function getMovieEmbeds($title) { $misc = new Misc(); //Step1 find key $movie_url = null; $html = file_get_html('https://primewire.unblocked.pe/'); $elements = $html->find('input[name=key]',0); $key = null; if(!is_null($elements)){ $key = $elements->value; } if(is_null($key)){ return array(); } $search = urlencode($title); $html = file_get_html("https://primewire.unblocked.pe/index.php?search_keywords=$search&key=$key&search_section=1"); $elements = $html->find(".index_item h2"); if(!is_null($elements)){ foreach($elements as $element){ $element_title = strtolower(strip_tags(trim(preg_replace('/\s*\([^)]*\)/', '', $element->innertext)))); if ($element_title == strtolower(trim($title))) { $parent = $element->parent(); $movie_url = "https://primewire.unblocked.pe".$parent->href; break; } } } if (is_null($movie_url)) { return array(); } $html = file_get_html($movie_url); $elements = $html->find(".movie_version_link a"); if(!is_null($elements)){ foreach($elements as $element){ $encoded_url = "https://primewire.unblocked.pe".$element->href; $query = parse_url($encoded_url, PHP_URL_QUERY); parse_str($query,$op); $link = base64_decode($op["url"]); if(strpos($link, "affbuzzads")===false && strpos($link, "webtrackerplus")===false){ $embed = $misc->buildEmbed($link); if ($embed) { $embeds[] = array( "embed" => $embed, "link" => $link, "language" => "ENG", ); } } } return $embeds; } return array(); } public function getEmbeds($title, $showid, $season, $episode) { $misc = new Misc(); $movie_url = null; $html = file_get_html('https://primewire.unblocked.pe/?tv'); $elements = $html->find('input[name=key]',0); $key = null; if(!is_null($elements)){ $key = $elements->value; } if(is_null($key)){ return array(); } $search = urlencode($title); $html = file_get_html("https://primewire.unblocked.pe/index.php?search_keywords=$search&key=$key&search_section=2"); $elements = $html->find(".index_item h2"); if(!is_null($elements)){ foreach($elements as $element){ $element_title = strtolower(strip_tags(trim(preg_replace('/\s*\([^)]*\)/', '', $element->innertext)))); if ($element_title == strtolower(trim($title))) { $parent = $element->parent(); $movie_url = "https://primewire.unblocked.pe".$parent->href; break; } } } if (is_null($movie_url)) { return array(); } $episode_url = str_replace("watch", "tv", $movie_url)."/season-".$season."-episode-".$episode; $html = file_get_html($episode_url); $elements = $html->find(".movie_version_link a"); if(!is_null($elements)){ $embeds = array(); foreach($elements as $element){ $encoded_url = "https://primewire.unblocked.pe".$element->href; $query = parse_url($encoded_url, PHP_URL_QUERY); parse_str($query,$op); $link = base64_decode($op["url"]); if(strpos($link, "affbuzzads")===false && strpos($link, "webtrackerplus")===false){ $embed = $misc->buildEmbed($link); if ($embed) { $embeds[] = array( "embed" => $embed, "link" => $link, "language" => "ENG", ); } } } return $embeds; } return array(); Thanks for taking your time to read! - Please be gentle! B-Man
  11. I've used the following note to save repeating i and copied them all into one file: note multiple attempts tried in the listed locations. public function getEmbeds($title,$showid,$season,$episode){ $misc = new Misc(); $title = $this->getTitle($title); //some issues look at later $link = "http://projectfreetv.so/".$title."/".$title."-season-".$season."/"; $this->curl->header(true); $page = file_get_contents($link); $code = 200; $page = explode("\r\n\r\n",$page); if (count($page)>1){ $page = $page[1]; } else { $page = $page[0]; } if ($code==200){ $searchstring = "season$season"."episode$episode"; $codes = 1; $ret = array(); $dom = new DOMDocument(); @$dom->loadHTML($page); $xp = new DOMXPath($dom); $tds = $xp->query('//td[@class="mnllinklist dotted"]'); for ($i=0;$i<$tds->length;$i++){ if ($tds){ $td = $tds->item($i); $linktitle = $td->getElementsByTagName('a')->item(0)->getElementsByTagName('div'); if ($linktitle->length){ $linktitle = $linktitle->item(0)->textContent; $linktitle = strtolower(preg_replace("/[^a-zA-Z0-9]/i","",$linktitle)); } else { $linktitle = ''; } $tmp = explode($searchstring,$linktitle); if (count($tmp)==2 && @$tmp[1]==""){ // we have the link I guess $videolink = $td->getElementsByTagName('a')->item(0)->getAttribute("href"); $test = str_replace('http://projectfreetv.so/watch/','',$videolink); $vdlink = urldecode($test); $videolink = substr($vdlink, 0, strpos($vdlink, "&ttl")); if (substr_count($videolink,"/player/")){ $tmp = explode("/player/",$videolink); $tmp = explode(".php?id=",$tmp[1]); if (count($tmp)!=2){ continue; } $host = $tmp[0]; $id = $tmp[1]; $link = $misc->makeLink($host,$id); if ($link){ $embed = $misc->buildEmbed($link); if ($embed){ $ret[$codes] = array(); $ret[$codes]['embed'] = $embed; $ret[$codes]['link'] = $link; $ret[$codes]['language'] = "ENG"; $codes++; //attempt 1 - print_r(array_values($embed)); //attempt 2 - var_dump($embed); //attempt 3 - echo count($embed); } } } } } } //attempt 1 - print_r(array_values($embed)); //attempt 2 - var_dump($embed); //attempt 3 - echo count($embed); return $ret; } else { return array(); } //attempt 1 - print_r(array_values($embed)); //attempt 2 - var_dump($embed); //attempt 3 - echo count($embed); }
  12. Hi, im really sorry, but adding var_dump does not work, i've turned display errors on too
  13. How would one echo these out? adding echo infront just displays a blank page?
  14. Hi all, Hopefully you guys can help me. I'm having an issue finding out what being outputted from the below class. Can someone please help me echo out what is being grabbing and stored (if any)? I've spent hours look and re-reading and i can't quite put my finger on it CODE: public function getEmbeds($title,$showid,$season,$episode){ $misc = new Misc(); $title = $this->getTitle($title); //some issues look at later $link = "http://projectfreetv.so/".$title."/".$title."-season-".$season."/"; $this->curl->header(true); $page = file_get_contents($link); $code = 200; $page = explode("\r\n\r\n",$page); if (count($page)>1){ $page = $page[1]; } else { $page = $page[0]; } if ($code==200){ $searchstring = "season$season"."episode$episode"; $codes = 1; $ret = array(); $dom = new DOMDocument(); @$dom->loadHTML($page); $xp = new DOMXPath($dom); $tds = $xp->query('//td[@class="mnllinklist dotted"]'); for ($i=0;$i<$tds->length;$i++){ if ($tds){ $td = $tds->item($i); $linktitle = $td->getElementsByTagName('a')->item(0)->getElementsByTagName('div'); if ($linktitle->length){ $linktitle = $linktitle->item(0)->textContent; $linktitle = strtolower(preg_replace("/[^a-zA-Z0-9]/i","",$linktitle)); } else { $linktitle = ''; } $tmp = explode($searchstring,$linktitle); if (count($tmp)==2 && @$tmp[1]==""){ // we have the link I guess $videolink = $td->getElementsByTagName('a')->item(0)->getAttribute("href"); $test = str_replace('http://projectfreetv.so/watch/','',$videolink); $vdlink = urldecode($test); $videolink = substr($vdlink, 0, strpos($vdlink, "&ttl")); if (substr_count($videolink,"/player/")){ $tmp = explode("/player/",$videolink); $tmp = explode(".php?id=",$tmp[1]); if (count($tmp)!=2){ continue; } $host = $tmp[0]; $id = $tmp[1]; $link = $misc->makeLink($host,$id); if ($link){ $embed = $misc->buildEmbed($link); if ($embed){ $ret[$codes] = array(); $ret[$codes]['embed'] = $embed; $ret[$codes]['link'] = $link; $ret[$codes]['language'] = "ENG"; $codes++; } } } } } } return $ret; } else { return array(); } } Thanks in advance! B-Man
  15. Ah i see how you're doing it, how would you move that above the output? trying to move $line is not working (i presume its outside the IF so the variable doesn't work)?
×
×
  • 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.