Solved

Get html source of the referring url

Posted on 2007-03-28
9
1,286 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
[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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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…
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.

738 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