Solved

Request one page

Posted on 2001-06-27
6
208 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 3

Expert Comment

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

Expert Comment

by:sweatje
Comment Utility
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
Comment Utility
$fcontents = join ('', file ('http://www.yahoo.com.net'));
does the same as sweatie
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

8 Experts available now in Live!

Get 1:1 Help Now