![]() |
Retrieving external dynamic pages with variables through PHP
I have encountered a bump on a project I am currently working on. The project requires a script to retrieve the content of an external page with variables for further processing, and I can't seem to get it to work even when using FSockOpen. This may, or should, be a failure on my part, but I looked the issue up in Google and found that others have had the same problem. Among other things, I found some interesting discussion forum threads, but the answers (if you can call it that) was rather vague and speculative and lead me no closer to a solution.
I know for a fact that what I am seeking to do is possible, some way or the other, but this is the first time I have had to retrieve content from external pages with variables. Any input would be highly appreciated. Danke schön. |
Not sure what you mean by "with variables" .. but for just saving the contents of a webpage to a variable, have you tried "file_get_contents"? Probably the easiest solution. :)
Could also use fopen and all that crap too |
odin:
simple, do the following: the external page should look something like this: PHP Code:
you would simply do: include("http://www.fuckyoutoo.com/some.php"); in your main file that needs the vars. You can of course also not use those strange echos and print the <? ?> directly in the file, but you have to make sure that the server that file is on will not parse it for php since it'll of course be empty for the include() then. |
bah
|
Quote:
I appreciate your time and effort though. |
Hey.. emm.
whats the problem about doing that? <G> $lines = file("http://www.somepage.com?with=vars&foo=bar"); that doesn't work for you? |
Quote:
|
Is PHP set up correctly to allow the fopen wrappers? That could be the reason why it doesn't work..?
Read about it here. |
Quote:
there to let you use the google api as rss/rdf feeds. I've got one that workds with news.google.com if you need one as an example. |
just use wget
|
Get a Google Api account and then check out http://www.jappc.com/google
|
|
If Google isn't the "dynamic pages" you want to pull variables from, then you'll probably need to do some sort of REG/EX to pull the correct values.
|
sexy
|
Quote:
|
The only way you can "trap" these variables is if you parse the URI in your php script. If they are hidden or session variables you are basically screwed unless you already know the variable names associated with the page you are attempting to 'scan'.
People that have accomplished what I think you are trying to do have been given explicit permission from the sites they are parsing and have been granted access to some sort of an API that said site(s) have available. I may not be Completely accurate here but I think that using any kind of TCP socket connection to said web page will not garner you the info you wish to gather. |
Also, look into CURL .. you can do a lot of
page scraping type work with CURL .. or just go to CPAN.org and search for page scrape and do your page scraping in perl |
All times are GMT -7. The time now is 02:48 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123