Reading remote text?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
robvan
Forum Newbie
Posts: 2
Joined: Wed Oct 18, 2006 12:58 pm

Reading remote text?

Post by robvan »

Hello,

I'm having a php issue that I imagine would be very easy to solve if I knew what to be searching for, and provided it's possible, which it really seems like it should be. I am writing a script, and I want to be able to run a remote php script and use the result of that in this script. For instance, the script at http://www.mydomain.com/script.php?variable=3 will, when run in a browser, write out a string. I want to write a php script on another domain that, when run, will call the first script, get the string it writes out, and use it to do something else.
Any help on how to do this, or a term to describe it that I could be searching for would be most appreciated,

Thanks,
Rob
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

##EDIT I may have misread the question, if so as feyd said, file_get_contents will dump the contents of one page, I thought you wanted to implement the script into your site.

PHP.net or google would do this trick.


the function(s) you're searching for vary on the exact purpose,

Code: Select all

<?php
include("http://www.phonybolognesite1.com/file.php");

require("http://www.phonybolognesite1.com/file.php");

include_once("http://www.phonybolognesite1.com/file.php");

require_once("http://www.phonybolognesite1.com/file.php");

?>
They all serve the same basic purpose, but there are nuances in their usage.
Last edited by akimm on Wed Oct 18, 2006 1:27 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

file_get_contents() if the allow_url_fopen directive is enabled. If not, cURL or some relative (Snoopy, perhaps.)
robvan
Forum Newbie
Posts: 2
Joined: Wed Oct 18, 2006 12:58 pm

Post by robvan »

Thank you both, file_get_contents was what I was looking for
Post Reply