Solved

Get html source of the referring url

Posted on 2007-03-28
9
1,283 Views
Last Modified: 2013-12-13
I have a php script that websites on the internet will use. I would like it so that every time a user loads a page with my php script, it sends me the html of the website, such as:

//the code goes here (get source code of the current website)
mail($my_email, " some subject", $SOURCE-OF-THIS-CURRENT-WEBSITE, "From: xxx");

I need this without using CURL! :)

Thank you.
0
Comment
Question by:sangeetha
9 Comments
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18808540
$html = fopen($_SERVER['PHP_SELF']);

just a thought, not tested.
0
 
LVL 2

Author Comment

by:sangeetha
ID: 18808637
but upto my knowledge, $_SERVER variable takes the server information of where the file is located.

For example, if "http://www.test.com/parse.php" is the script which I need and if "http://www.example.com/file1.php" is the file that accesses the parse.php file, I need to know the source code of the "http://www.example.com/file1.php".
0
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 38 total points
ID: 18809368
That's what the fopen() is for.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 29

Assisted Solution

by:TeRReF
TeRReF earned 37 total points
ID: 18810003
$html = file_get_contents($_SERVER['HTTP_REFERER']);
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18810642
file_get_contents(), a better choice.
0
 
LVL 11

Expert Comment

by:JamesCssl
ID: 18813383
<?php
$handle = fopen($_SERVER['HTTP_REFERER'], "r");
$contents = '';
while (!feof($handle)) {
  $contents .= fread($handle, 8192);
}
fclose($handle);
?>

$contents contains the source of the referring site
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18813511
I suggested fopen() also, but really file_get_contents() is a better option for this particular question.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21291955
Forced accept.

Computer101
EE Admin
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
comma true 6 34
does post require a form or curl to be post 4 35
how to use a switch statement with heredoc 11 25
mysqli_connect error on wamp but not on remote server 8 27
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

832 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