473,326 Members | 2,124 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,326 software developers and data experts.

Reading from a Dynamic Page

Hi,

Currently I need to read contents from a dynamic page, which goes
something like:
http://servername/filename.jsp?arg1=a&arg2=b

The content is not static, neither is there a file for me to read
from. Thus, I would like to know how could I accomplish this task in
php. I saw from forums, there is a similar implementation of the RSS
reader which reads it in the following way:

$fileName = url;

$data = implode("", file($fileName));
....

Will I be able to do the same thing?

I am rather new to php, so would appreciate any help rendered. Thanks!

May 18 '07 #1
5 2644
At Fri, 18 May 2007 02:49:07 -0700, ycquak let his monkeys type:
Hi,

Currently I need to read contents from a dynamic page, which goes
something like:
http://servername/filename.jsp?arg1=a&arg2=b

The content is not static, neither is there a file for me to read from.
Thus, I would like to know how could I accomplish this task in php. I
saw from forums, there is a similar implementation of the RSS reader
which reads it in the following way:

$fileName = url;

$data = implode("", file($fileName)); ...

Will I be able to do the same thing?

I am rather new to php, so would appreciate any help rendered. Thanks!
You can open a webpage using file() if your server allows opening remote
files, but AFAIK parsing the variables like this isn't gonna work. Instead
you probably want to use cURL to send the right http-request.

Side note: implode("", file($filename)) can be replaced with
file_get_contents($filename), which reads the file into a string directly.

Sh.
May 18 '07 #2
yc
Hi,

I did a search of curl. It seems that my host doesn't support the
usage of curl. In this case, is there any other workaround? Am I able
to retrieve the data from this remote site and then save it to a file,
and read from it? Thanks!

yc

On May 18, 8:23 pm, Schraalhans Keukenmeester <inva...@invalid.spam>
wrote:
At Fri, 18 May 2007 02:49:07 -0700, ycquak let his monkeys type:
Hi,
Currently I need to read contents from a dynamic page, which goes
something like:
http://servername/filename.jsp?arg1=a&arg2=b
The content is not static, neither is there a file for me to read from.
Thus, I would like to know how could I accomplish this task in php. I
saw from forums, there is a similar implementation of the RSS reader
which reads it in the following way:
$fileName = url;
$data = implode("", file($fileName)); ...
Will I be able to do the same thing?
I am rather new to php, so would appreciate any help rendered. Thanks!

You can open a webpage using file() if your server allows opening remote
files, but AFAIK parsing the variables like this isn't gonna work. Instead
you probably want to use cURL to send the right http-request.

Side note: implode("", file($filename)) can be replaced with
file_get_contents($filename), which reads the file into a string directly.

Sh.

May 19 '07 #3
At Fri, 18 May 2007 21:04:21 -0700, yc let his monkeys type:
Hi,

I did a search of curl. It seems that my host doesn't support the
usage of curl. In this case, is there any other workaround? Am I able
to retrieve the data from this remote site and then save it to a file,
and read from it? Thanks!

yc
http://pear.php.net/package/HTTP_Client may help you (if PEAR is supported
by your host.)

Sh.
May 19 '07 #4
yc****@gmail.com wrote:
Hi,

Currently I need to read contents from a dynamic page, which goes
something like:
http://servername/filename.jsp?arg1=a&arg2=b

The content is not static, neither is there a file for me to read
from. Thus, I would like to know how could I accomplish this task in
php. I saw from forums, there is a similar implementation of the RSS
reader which reads it in the following way:

$fileName = url;

$data = implode("", file($fileName));
...

Will I be able to do the same thing?

I am rather new to php, so would appreciate any help rendered. Thanks!
You don't simply try it

echo file_get_contents("http://www.google.com/search?q=blah");

what does this do?

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
May 19 '07 #5
At Sat, 19 May 2007 13:24:04 +0200, gosha bine let his monkeys type:
yc****@gmail.com wrote:
>Hi,

Currently I need to read contents from a dynamic page, which goes
something like:
http://servername/filename.jsp?arg1=a&arg2=b

The content is not static, neither is there a file for me to read
from. Thus, I would like to know how could I accomplish this task in
php. I saw from forums, there is a similar implementation of the RSS
reader which reads it in the following way:

$fileName = url;

$data = implode("", file($fileName));
...

Will I be able to do the same thing?

I am rather new to php, so would appreciate any help rendered. Thanks!

You don't simply try it

echo file_get_contents("http://www.google.com/search?q=blah");

what does this do?
My bad Gosha, I suggested he couldn't. The fact I hadn't ever tried it
doesn't always mean it's not possible. Never too old to learn from my
mistakes...

Sh.

May 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marc | last post by:
Hello, I have a question about how PHP handles multiple file reads/ writes. I made a page containing a self-submitting form where the user can type his name, topic and a text. When he submits the...
1
by: Roger Godefroy | last post by:
Hi there... I want to read fieldvalues from out of a dynamicaly created table (php). But this has to be done by JavaScript. Every row of the table has a select-box, inputbox and a order-button....
7
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
10
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're...
5
by: pittendrigh | last post by:
There must be millions of dynamically generated html pages out there now, built by on-the-fly php code (and jsp, perl cgi, asp, etc). Programatic page generation is transparently useful. But...
2
by: Kuldeep | last post by:
Hi All, I am trying to read the contents of a page through its URL. My code snippet is as follows: public void mtdGetPageDataHWR() { HttpWebRequest objRequ =...
9
by: Milsnips | last post by:
Hi all. i'm tryng to implement the Rewrite.NET url rewritining functionality into a test project i've created, however i am hitting a problem at this line (direct from the web example): ...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.