Solved

Request one page

Posted on 2001-06-27
6
211 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

919 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now