473,387 Members | 1,530 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,387 software developers and data experts.

Getting info from a website.

I have been doing PHP for over a year now but when I came round to
writing a script I discovered that there was a reasonably sizeable gap
in my knowledge that I didn't even know where to start finding out
about. Anyway this is a reasonably nooby question:

If I have a script on http://url-a.com/script.php and I want to get
some dynamic information of my friend's site at
http://url-b.com/info.php , How can I get it? I need to use get
variables in getting it and it must also be server side.

Many Thanks,
Michael.

Apr 2 '06 #1
3 1207
On Sun, 02 Apr 2006 01:22:03 -0800, Michael wrote:
I have been doing PHP for over a year now but when I came round to writing
a script I discovered that there was a reasonably sizeable gap in my
knowledge that I didn't even know where to start finding out about. Anyway
this is a reasonably nooby question:

If I have a script on http://url-a.com/script.php and I want to get some
dynamic information of my friend's site at http://url-b.com/info.php , How
can I get it? I need to use get variables in getting it and it must also
be server side.


You may be able to use fopen (depending on your hosts configuration) to
open remove sites, but an arguably better way is to use the curl_*
functions (start looking in the man page for curl_init).

You can pass in GET parameters to it either way by using the normal
"http://url-b.com/info.php?bar=1&foo=abc" format in either call.

Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Apr 2 '06 #2
Message-ID: <11**********************@i40g2000cwc.googlegroups .com> from
Michael contained the following:
If I have a script on http://url-a.com/script.php and I want to get
some dynamic information of my friend's site at
http://url-b.com/info.php , How can I get it? I need to use get
variables in getting it and it must also be server side.


Preg_match() ?

The manual contains the following example

preg_match("/<title>(.*)<\/title>/i", $html_content, $match);

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Apr 2 '06 #3
Did you want to get the entire output of the website, or do you have
that already and need to get some information within a html tag?

Curl is definetly the best way to go for the first one, and Geoff's
example is probably the best for the second one (although I haven't
played with regular expressions yet)

Apr 3 '06 #4

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

Similar topics

2
by: Timo J | last post by:
Hi - Im sitting and trying to understand this OOP - and need to create a class wich can do the following.. ShowBlocks() - Displays the data wich is inside it - If empty creates a form wich sends...
6
by: Jim Flack | last post by:
I have a new website hosted by www.easily.co.uk which contains a mysql database (I have the initial access codes etc ). My problem is I have never used PHP or dealt with mysql before. I have tried...
14
by: z_learning_tester | last post by:
But I can't seem to find the answer. The question is how do you reverse the words in a string? Or how do you reverse the numbers listed in a string? The example is usually something like: Turn...
3
by: Pitmairen | last post by:
I want to make a program that get info from a website and prints it out in a txt file. I made this: import urllib f = urllib.urlopen("http://www.imdb.com/title/tt0407304/") s = f.read() k =...
0
by: Michael | last post by:
I have been doing PHP for over a year now but when I came round to writing a script I discovered that there was a reasonably sizeable gap in my knowledge that I didn't even know where to start...
2
by: Lucky | last post by:
hi guys, few days back i've posted a question regarding how can i get the list of the websites form the IIS, at this location: ...
1
by: Alfonso Acosta | last post by:
Hi all, exif_read_data() doesn't support URLs (http://php.net/manual/en/function.exif-read-data.php ) but I would like to do that with the minimum traffic and overhead possible. A naive...
3
by: h4xPace | last post by:
I am building a MySQL query application, and I have run into a small snag. MySQL has released a set of classes that extend the .NET framework base data classes (command, connection, etc), and I am...
2
by: =?Utf-8?B?SmFtZXM=?= | last post by:
Hello all, I have this idea that might not work, our website is built by someone else and is a CMS website. There is a page with links to other websites and at the moment I have created a file...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.