Solved

Request one page

Posted on 2001-06-27
6
224 Views
Last Modified: 2006-11-17
How can we request one page any server and the return value is the content of this page, like
when we request : http://www.yahoo.com in my browser
The content (return value) is on my browser.
But how can I capture it into my Server.
0
Comment
Question by:longlong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:anupkarade
ID: 6231193
Your question is not clear...
Do you mean to say that you type url and you get the
required page?? what are you trying to tell pls explain it clearly.
            Anup
0
 
LVL 8

Expert Comment

by:us111
ID: 6231208
here is the answer:
$fcontents = join ('', file ('http://www.yahoo.com.net'));

but you cannot get the content of an https (SSL) url, for that you need the curl extension
0
 
LVL 2

Expert Comment

by:higijj
ID: 6232025
us111 is right!

here is how for the secure connection using curl extention:

$ch = curl_init();

     curl_setopt ($ch, CURLOPT_URL, "https://www.yoursecureserver.com/");
     curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
     curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
     $content = curl_exec($ch);

curl_close($ch);
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 3

Expert Comment

by:izwiz
ID: 6237216
It actually sounds like you want to set up a proxy cache on your server to me.
0
 
LVL 1

Expert Comment

by:sweatje
ID: 6240090
I have used code like the following:

$f_contents = array();
$fp = @fopen("http://www.example.com/somepage.php?var=$parm",'r');
while ($line = @fgets($fp, 1024)) {
     $f_contents[] = $line;
}
@fclose($fp);

You can then parse the page and do whatever you like with the output, each line in the page is an item in the $f_contents array.


0
 
LVL 8

Accepted Solution

by:
us111 earned 50 total points
ID: 6240435
$fcontents = join ('', file ('http://www.yahoo.com.net'));
does the same as sweatie
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question