Jump to content

Recommended Posts

<?php

$homepage = file_get_contents('http://www.example.com/');

echo $homepage;

?>

 

that doesnt work... i actually want the source code displayed not the html.

 

what im expecting is lines of html code.

 

 

<?php
$homepage = file_get_contents('http://www.google.com/');
echo $homepage;
?>

 

shows the search bar and buttons, but what i wanna see is the source, the inputs etc

that doesnt work... i actually want the source code displayed not the html.

 

what im expecting is lines of html code.

 

You just contradicted yourself.  What exactly are you trying to see?  You cannot see server side code, only client side.

$addr = 'http://google.com';
$fp   = file_get_contents($addr);

echo stripslashes(htmlentities($fp, ENT_QUOTES));

 

 

thats working brilliantly, now i need help with one more thing.

 

i want to search for 2 things inside the source code.

 

first thing is a image... i was thinking of somehow making a search for starting in http:// and ending in .jpg

 

second i need to find the same thing for a .avi file

 

starting in http:// and ending in .avi

 

they need to then be set as variables to i can use them with my db.

the only reason "that works brilliantly" is that you can now see the HTML-formatted HTML in your browser. however, what you are seeing is no longer the same as the source code you see on the website. Maq is correct: the previous code is what you want.

the only reason "that works brilliantly" is that you can now see the HTML-formatted HTML in your browser. however, what you are seeing is no longer the same as the source code you see on the website. Maq is correct: the previous code is what you want.

 

for some reason the other code didn't show the source, the current code may not show the true source but it does show the part of the code I need.

 

now i just gotta search for the two links in the code.

 

what would be the most efficient way of doing this?

It sounds to me you need something more like html dom and to fetch tags from the page, like images,href, or anything else you want located in a divider or in the html.

 

http://simplehtmldom.sourceforge.net/

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.