473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

GetBetween in combination with file_get_contents

I want a certain part of an external webpage on my page. I searched the internet and found the function GetBetween, which I've put in my page:
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function GetBetween($content,$start,$end){
  3.     $r = explode($start, $content);
  4.     if (isset($r[1])){
  5.         $r = explode($end, $r[1]);
  6.         return $r[0];
  7.     }
  8.     return '';
  9. }
  10. </script>
I want a certain table from this website: http://www.keynet.tv/agenda.php?q=us...0381&f=month/1

so I coded this:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $homepage = file_get_contents('http://www.keynet.tv/agenda.php?q=user/show/40381&f=month/1');
  3. echo GetBetween($homepage, "<h1>Agenda</h1>", "<!-- LEGENDE -->");
  4. ?>
but that doesn't work...
Aug 6 '12 #1

✓ answered by boodschap

Solution was easy: function GetBetween should be in "<?php"

1 1705
Solution was easy: function GetBetween should be in "<?php"
Aug 6 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rob | last post by:
for some reason i keep getting : Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/rob/www/php/filegetcontents2.php on...
2
by: ggg | last post by:
Here's what I'm trying to do. The server serves up XML documents based on what I specify in the GET string. This is on a server I have no control over. There is a lag between the time when I...
1
by: jjainschigg | last post by:
I'm running PHP 5 on a shared VPS. I have a couple little apps that are using file_get_contents() and readfile() for various kinds of (what should be) low-overhead, fast outbound accesses ... that...
5
by: howa | last post by:
are there any advantage in replacing all fread() operations with file_get_contents() ? i.e. file_get_contents("/usr/local/something.txt") VS $filename = "/usr/local/something.txt";
4
by: Aetherweb | last post by:
This is probably really obvious, sorry, been a long day... I'm wanting to create a PHP file which is a template for an email, and read the file into a string, ready to send out using my email...
9
by: howa | last post by:
Target: To fetch a file using PHP and send to user Method 1: echo file_get_contents( $file_path ); Method 2: readfile( $file_path );
6
by: Taras_96 | last post by:
Hi everyone, The output of echo file_get_contents("http://watchout4snakes.com/creativitytools/ RandomWord/RandomWordPlus.aspx"); leaves the browser empty.. no error messages, nothing. ...
0
by: pac1250 | last post by:
Hi, I am searching how to solve a problem and I dont find it :( I want to access a page from a script behind a proxy : (my script) <-(a proxy with authentification) <-(https serveur with...
6
by: Pheddy | last post by:
Hey i tried this code to get the country and IP via PHP (from: http://roshanbh.com.np/2008/07/getting-country-city-name-from-ip-address-in-php.html) function countryCityFromIP($ipAddr) {...
6
AaronL
by: AaronL | last post by:
Hello, I'm writing a sophisticated e-commerce software suite in PHP. What I want to be able to do is have customers use my software but not have access to the source code of my PHP so they can't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.