getting source of a page into a variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
electronicrow
Forum Newbie
Posts: 3
Joined: Mon Aug 22, 2005 2:00 am

getting source of a page into a variable

Post by electronicrow »

Hi everybody!!!

I want to get the source of a page into a variable:

Please use this url as an example:(It is important for me to get the source but esspecially this page)

http://v3.espacenet.com/results?sf=a&FI ... &=&=&=&=&=
(THE PAGE EXISTS YOU CAN TRY!!!)

Anyone who believes that it can not be get , pls give a logical reason

take it easy!
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

file_get_contents() can be used for this.

Code: Select all

<?php
$url = 'http://v3.espacenet.com/results?sf=a&FIRST=1&CY=ep&LG=en&DB=EPODOC&TI=ocular+delivery&AB=&PN=&AP=&PR=&PD=&PA=&IN=&EC=&IC=&=&=&=&=&=';
$contents = file_get_contents ($url);
echo $contents;
?>
electronicrow
Forum Newbie
Posts: 3
Joined: Mon Aug 22, 2005 2:00 am

It didn't work

Post by electronicrow »

My friend did you try it?(If you didn't pls try!)
It doesn't work on my computer!
Do I have to fix something?

take it easy!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

If my browser can get the page, so can my script. Meaby, their script is look at a User-Agent header string or whatever, which you have to simulate...

Might want to search for "get amazon" on this forum, as we've mentionned a couple of workarounds for this problem.

viewtopic.php?t=36211
electronicrow
Forum Newbie
Posts: 3
Joined: Mon Aug 22, 2005 2:00 am

Post by electronicrow »

Thank you very very very much :) !!!
Post Reply