Executing A URL

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
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Executing A URL

Post by icesolid »

I was wondering how I can execute an include like create.php?id=10000 within a script. I know that allow_url_include must be turned on but I really do not watn to do that.

I was looking into cURL, but that seems to read the file out to the page?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Executing A URL

Post by aceconcepts »

How about using a function to pass the id to?
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Re: Executing A URL

Post by icesolid »

How would I go about that?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Executing A URL

Post by aceconcepts »

Well what was going to happen inside create.php?
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Re: Executing A URL

Post by icesolid »

Problem is on the next page headers are being sent. So I don't think that this will work anyways.

I am doing it like so.

Code: Select all

<?php
$_GET["temp"] = true;
$_GET["id"] = "10000";
include("create.php");
?>
Problem is in the file create.php I am using header() for the creation of the PDF. So I am getting headers already sent errors.
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Re: Executing A URL

Post by icesolid »

I have come up with a solution. Anyone interested here it is:

Code: Select all

<?php
$ch = curl_init("http://www.websitename.com/modules/create.php?temp=true&id=" . $row["id"] . "");
 
curl_exec($ch);
curl_close($ch);
?>
Curl was the way to go.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Executing A URL

Post by aceconcepts »

Or you could have used an include

Code: Select all

 
$temp=1;
$id=$row['id'];
 
include("create.php");
 
Post Reply