Jump to content

[SOLVED] Opening and executing


PHPNewbie55

Recommended Posts

Well, if you simply want to display file contents, you can use something like file_get_contents() or fopen()

 

However, if you actually want to execute the file, you can use something like exec() or system()

 

Hope this helps.

Link to comment
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"...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...  ???

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.