posting contents of td in sperate page
Moderator: General Moderators
posting contents of td in sperate page
First off, let me apologize for this incoherent post that will follow. I am no php expert, I am just learning. I already know what I want to do, I just need to learn the means to do it. So here goes:
lets say I have a page called info.php
on this page, things are displayed like:
Name:
bob
and when you view source on the page, it looks something like this:
<th>Name:</th>
<td name=name1> bob </td>
and lets say I have a seperate page called output.php
is there a way i can have output.php display the contents of the td named "name1"?
I know if the td was set a a variable like $name it would be simple. But I am unsure how/if I can have php display the contents of a td tag based on its name in html
lets say I have a page called info.php
on this page, things are displayed like:
Name:
bob
and when you view source on the page, it looks something like this:
<th>Name:</th>
<td name=name1> bob </td>
and lets say I have a seperate page called output.php
is there a way i can have output.php display the contents of the td named "name1"?
I know if the td was set a a variable like $name it would be simple. But I am unsure how/if I can have php display the contents of a td tag based on its name in html
if you have access to the file, open and parse it.
otherwise, theres a php defined function that reads web pages and you can parse off that, http://php.net for ref.
otherwise, theres a php defined function that reads web pages and you can parse off that, http://php.net for ref.
hmm, well I dont have access to the file itself, and whats worse is I think its dynamically generated.
Heres what I have so far:
<?php
$url = “https://<?php echo $_POST["name"] ?>”;
$content = readfile($url);
?>
So basically, I have a form that takes you to this page, and inserts the forms input as the url after https://
From the article i got this from, it tells me that it stores the webpages information in $content, is this correct?
If so, how would I get php to display (using my previous example) the contents of the td tag named "name1" contained within that page?
P.S. I really appreciate you guys for offering advice, I expected you to flame me to death for being such a novice
Heres what I have so far:
<?php
$url = “https://<?php echo $_POST["name"] ?>”;
$content = readfile($url);
?>
So basically, I have a form that takes you to this page, and inserts the forms input as the url after https://
From the article i got this from, it tells me that it stores the webpages information in $content, is this correct?
If so, how would I get php to display (using my previous example) the contents of the td tag named "name1" contained within that page?
P.S. I really appreciate you guys for offering advice, I expected you to flame me to death for being such a novice
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Do you have permission to use their pages on your site?
If you read the documentation on readfile() you'll notice it returns an integer, not a string.
If you read the documentation on readfile() you'll notice it returns an integer, not a string.
use
$content=file_get_contents("url");
can you echo $content and tell me what it is? remember if it has html tags then go to view source to see the exact output.
$content=file_get_contents("url");
can you echo $content and tell me what it is? remember if it has html tags then go to view source to see the exact output.
Last edited by nincha on Mon Aug 14, 2006 2:13 pm, edited 2 times in total.
Do you mean whether the server the files are on allows for fopen? im not sure, but so far, im not seeing errors.
if you mean to I have permission from the developers to use their files in this way, I do. However, there is sensitive information available to me if I were to get FTP access, thats why they cant give it.
<?php
$handle = fopen("https://<?php echo $_POST["name"] ?>", "r");
?>
so does this command store the contents of https://(whatever i submit on the form) in $handle ? or is there anyther command within fopen I need to use to do this.
if you mean to I have permission from the developers to use their files in this way, I do. However, there is sensitive information available to me if I were to get FTP access, thats why they cant give it.
<?php
$handle = fopen("https://<?php echo $_POST["name"] ?>", "r");
?>
so does this command store the contents of https://(whatever i submit on the form) in $handle ? or is there anyther command within fopen I need to use to do this.
ps, sorry i didnt see your post nincha, I used your code to do this:
<?php
$content=file_get_contents("http://yahoo.com");
echo $content
?>
it works great, the problem is, it doesnt seem to work with Secure URL's, is there an option for file_get_contents that supports SSL?
there is a php info on the server:
http://godsannointed.org/phpinfo.php
its showing curl and openssl as supported.
I tried modifying the link to ssl:// instead of https:// but that didnt work
<?php
$content=file_get_contents("http://yahoo.com");
echo $content
?>
it works great, the problem is, it doesnt seem to work with Secure URL's, is there an option for file_get_contents that supports SSL?
there is a php info on the server:
http://godsannointed.org/phpinfo.php
its showing curl and openssl as supported.
I tried modifying the link to ssl:// instead of https:// but that didnt work