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. Thanks mate! It was alot simpler than i thought and your code has actually taught me how to set cookies in php so thanks for that! +1
  2. Hey dude I completely understand, there is no key or anything, the API, I'd rather not sure due to forum rules but for example; the URL is blah.com/user-api/thing?latest If I'm logged in that link works and it displays; however if I'm not logged in and I go to that URL it directs me to the login page. There's no api key at all simply that URL works when logged in but not if you're a 'guest' There is no manual to read but it's still the best API I have found. I'm at a loss on what else to try. Hope this makes sense, I know this reply is like throwing your head against the wall but I don't know what else to answer
  3. Evening all! I'm running into an issue where a site i have signed up to provides an API, however when I try to decode it on my server it outputs: The PHP script being used: $url = file_get_contents("http://apiwebsite.com/blah?latest"); $json = json_decode($url, true); // decode the JSON into an associative array echo '<pre>' .var_dump($json, true). '</pre>'; When i try to browse to this site on my server it redirects to a website. Is there a way to bypass the login? or actually login to get the API? Thanks everyone
  4. Hi all, Just a quick one, i would like to monitor an API for changes, so the first run on the API would be to grab all 315 pages and enter them into my database, once added, i want to set up a cron job (i can do that) to monitor if anything gets added, im not sure whats the best way to go about that? Anyone have any ideas to point me in the right direction please?
  5. Whoops, got that fixed: for people in the future: $genres = explode(",",$genre); foreach($genres as $value){ echo $value . ", "; } My question for people, how do i remove the comma from the last one?
  6. Hey all, I'm trying to strip commas and put the single words into an array: for example: output will be like: action, comedy, horror, war What i need to do is strip the comma and add the single words into an array called genres.. is this possible? I got the stripping done like so: $genres = str_replace(',',' ',$genre); but as you can see it only adds a space, i want to have them as single words so i can hyperlink them to different pages. Any help in pointing me the right way would be amazing! Thanks ALL
  7. Hi all, I'm annoyed because i cant figure this out, I want to crawl a website scan for links to the videos, not 100 percent if it can be done. The code dump is below; not 100 percent whats going wrong, i cant figure out what stage its failing. Can someone provide a poke please? <?php class Movie2k{ public $curl = null; public $misc = null; public $domain = "[redacted]"; function __construct(){ $this->curl = new Curl(); $this->misc = new Misc(); } public function getEmbeds($show,$season,$episode){ $show_url = $this->getShowUrl($show); $res = array(); $pages = array(); $counter = 1; if ($show_url){ $season_url = str_replace("-season-","-episode-$season-",$show_url); $page = $this->curl->get($season_url); $dom = new DOMDocument(); @$dom->loadHTML($page); $tables = $dom->getElementsByTagName('table'); for($i=0;$i<$tables->length;$i++){ if ($tables->item($i)->getAttribute("id")=="tablemoviesindex"){ $rows = $tables->item($i)->getElementsByTagName('tr'); for($j=0;$j<$rows->length;$j++){ $tds = $rows->item($j)->getElementsByTagName('td'); if ($tds->length==5){ $compare = preg_replace("/[^a-z0-9]/","",strtolower($tds->item(0)->textContent)); $img = $tds->item(4)->getElementsByTagName('img'); if (!$img->length){ continue; } if (strpos($compare,"episode$episode") == strlen($compare)-strlen("episode$episode") && substr_count($img->item(0)->getAttribute("src"),"us_flag")){ $type = strtolower(trim($tds->item(1)->textContent)); $type = explode("watch on",$type); $type = trim($type[1]); $link = $tds->item(0)->getElementsByTagName('a'); if (!$link->length){ continue; } $link = $this->domain.$link->item(0)->getAttribute("href"); $pages[] = array("link" => $link, "type" => $type); } } } } } } if (count($pages)){ foreach($pages as $key => $val){ if ($val['type']!="stream2k"){ $data = $this->getLink($val['link']); if ($data){ $embed = array(); $embed['language'] = "ENG"; if (isset($data['link'])){ $embed['embed'] = $this->misc->buildEmbed($data['link'],620,360); if (!$embed['embed']){ continue; } $embed['link'] = $data['link']; } elseif (isset($data['embed'])){ $link = $this->misc->buildLink($data['embed']); if (!$link){ continue; } $embed['embed'] = $data['embed']; $embed['link'] = $link; } $res[$counter] = $embed; $counter++; } } } } return $res; } public function getLink($url){ $page = $this->curl->get($url); $dom = new DOMDocument(); @$dom->loadHTML($page); $res = false; $links = $dom->getElementsByTagName('a'); for($i=0;$i<$links->length;$i++){ $img = $links->item($i)->getElementsByTagName('img'); if ($img->length){ $src = $img->item(0)->getAttribute("src"); if (substr_count($src,"click_link.jpg")){ return array("link" => $links->item($i)->getAttribute("href")); break; } } } if (!$res){ // finding embed then $divs = $dom->getElementsByTagName('div'); for($i=0;$i<$divs->length;$i++){ if ($divs->item($i)->getAttribute("id")=="emptydiv"){ $html = $this->getInnerHTML($divs->item($i)); preg_match("/\<iframe.*\<\/iframe\>/i",$html,$matches); if (count($matches)){ return array("embed" => $matches[0]); } } } } return $res; } public function getInnerHtml( $node ) { $innerHTML= ''; $children = $node->childNodes; foreach ($children as $child) { $innerHTML .= $child->ownerDocument->saveXML( $child ); } return $innerHTML; } public function getShowUrl($show){ $first_letter = strtoupper($show[0]); $stripped_show = preg_replace("/[^a-z0-9]/","",strtolower($show)); $page = $this->curl->get("[redacted]"); $dom = new DOMDocument(); @$dom->loadHTML($page); $res = false; $tables = $dom->getElementsByTagName('table'); for($i=0;$i<$tables->length;$i++){ if ($tables->item($i)->getAttribute("id")=="tablemoviesindex"){ $rows = $tables->item($i)->getElementsByTagName('tr'); for($j=0;$j<$rows->length;$j++){ $tds = $rows->item($j)->getElementsByTagName('td'); if ($tds->length==2){ $img = $tds->item(1)->getElementsByTagName('img'); if ($img->length && substr_count($img->item(0)->getAttribute("src"),"us_flag")){ $compare = preg_replace("/[^a-z0-9]/","",strtolower($tds->item(0)->textContent)); if ($compare == $stripped_show){ $link = $tds->item(0)->getElementsByTagName('a'); if ($link->length){ $res = $this->domain.$link->item(0)->getAttribute("href"); break; } } } } } break; } } return $res; } } ?>
  8. 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... )
×
×
  • 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.