Jump to content

[SOLVED] Opening and executing


PHPNewbie55

Recommended Posts

Is there a way to open a file and execute the contents of that file just like a person would if they opened the file in a browser?

I have looked all through this page:

http://us.php.net/manual/en/function.fgetss.php

 

And I have tried to find a way to do this but haven't had any results....

 

Any suggestions??

Link to comment
https://forums.phpfreaks.com/topic/150125-solved-opening-and-executing/
Share on other sites

Thanks but those won't work...

 

What I am looking to do is spider a bunch of links on a page just as if a person clicked on them..  in order to run the queries on the individual pages..

If it was a matter of a few links I would just click on them.. but there are 1000's of links I need to "click on"...

You can use file_get_contents to grab the HTML source and then run it through a parsing function to scape links. You won't be able to run this indefinitely-running script through your browser unless you had a customized ajax interface (think $100's). You'll need to run this on the command line.

There has got to be a way to do this without going through the command line...

 

When a spider crawls my site for example and hits a page with search.php?q=search term

it executes the query using the ?q=search term as a parameter...  so there has got to be a way to "crawl" links and execute the php code on the page..

 

like a bot... feed it a bunch of urls and let it go until the end...

I am just looking for the correct function to use to open a link

 

There has got to be some way to do it...  ???

 

 

 

 

include("http://www.domain.com/file.php?search=q1");
include("http://www.domain.com/file.php?search=q2");
include("http://www.domain.com/file.php?search=q3");

 

when u include a URL, PHP actually gives a hit to that URL as if a user has clicked on it and then includes the HTML output.. check if this is what u need.

 

It may require some php.ini configurations to allow to read a URL.

That sounds like it might just work but my server won't allow any variables in the urls like php?search=q1

 

It wouldn't be that bad either each page is less that 1kb so it wouldn't take too long....

What I need to do is run about 1000 individual queries on a search page..  but the search page does a little more than search..

it updates the results in the table... it is hard to explain..

 

I could probably reset the ini with something like this IF..  I knew what to set it to... LOL  I don't mess with my PHP.ini much

ini_set ("????", "????");

 

ANY SUGGESTIONS...?

It looks like your host has remote requests of all kinds disabled x.x.

 

 

You don't technically need to use http:// though.  Actually, to get the advantage of keep-alive connections, you can't do that.

 

You would just use the host name and port, then you would write HTTP headers to the socket then read back the response.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.