Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

hit a page from PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

hit a page from PHP

Postby pgutin » Tue Mar 18, 2003 2:24 pm

Ok, this is a pretty stupid question, but i'd like to ask. Is there any way to just generate a hit on a webpage from PHP? By a hit i mean something that would just send a request to a server, and if there's a counter on it, the counter would get incremented. No, i am not trying to hack anything, this is strictly for my personal use and enjoyment.
Thank you
pgutin
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 18, 2003 2:14 pm

Postby Xerpher » Tue Mar 18, 2003 2:52 pm

The only way I could think of this working would be to use a function (probibly readfile() or fopen()) you open the site but not actually put on th page... I'll try it right now :)
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Postby Xerpher » Tue Mar 18, 2003 3:26 pm

Ok, I got it, heres all you need:

Code: Select all
<?php
ob_start();
readfile('http://www.domain.com/counter.php');
ob_clean();
?>

First and last command will make sure nothing from the url gets printed on the page.
Middle command opens the page.

Any more questions, just ask :D
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Postby pgutin » Tue Mar 18, 2003 5:05 pm

great, i am trying the code right now!
pgutin
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 18, 2003 2:14 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.