Click to See Complete Forum and Search --> : Help Me Out [Please]


zubair1
07-30-2008, 02:08 PM
Hello,

I'm new here :) as you all can see :)

I have a big situation at hand, which i really want to resolve :(

I am trying to make a PHP application -

The only problem i am facing is that i want to load value to a form which i am getting from a iframe or frame.

Let me try to make it alittle more clearer -

i have a php page which displays some links of web directories for example ("http://www.cyberpk.net/links/submit.php")

When the user clicks on that link it opens up in the iframe or Frame window.

The Problem (More Clear) :(:-
If you checkout the above site you'll see its a link to a web directory
which is showing a form with some input fields

I want to load that page in a frame/iframe and also populate the input fields with my own values as soon as it loads.

Yes, i'm trying to make auto directory submitter
one that when used user will only have to enter a captcha(if required) and press the submit button to submit their website.

I would really appreciate if some one can help me :( i've been wanting to do this for a long time but am stuck on this part for over a year :(

Thank you!
Regards,

Kyleva2204
07-31-2008, 03:16 AM
Took me about 100 times of reading this to finally understand what your asking..

How much PHP do you know?

instead of doing an iFrame, why not ask for the persons URL and then use PHP to grab the information using regular expressions.. Matching HTML elements of their site, for example, to get the page title you would use the code:
$html_source = file_get_contents($their_website_url);
preg_match('/<title>(.*)</title>/',$html_source,$page_title);
$page_title = $page_title[1];

In that code, $page_title is now set to the web sites title... Hope this helps you move on.

zubair1
07-31-2008, 04:08 AM
Thanks Kyleva2204

Sorry for being confusing :( but i really am confused with this :(

i'm not fully aware about preg/regex :(

I am wanting to input default values or you could say i am wanting to populate the fields with my own values when the page loads in the frame/iframe.

After that the user would be able to submit the form, so that his / her website could be listed in that directory.

do you think preg/regex would be able to accomplish this?

If you could please show me a one page small example that can do this i would be very thankful to you -

i'll also try to put an online example of what i'm trying to do if you think that i'm still not making any sense :(

Regards,

Kyleva2204
07-31-2008, 04:59 AM
This is what I was talking about, I would think this would be easier than doing an iFrame.. That is, if Im 100% getting waht your trying to accomplish.

Name the file simple_example.php and run it.

<?php
if (isset($_POST['done'])){
echo 'Thank you for your submission.';
exit;
}

if (!isset($_POST['url'])){
echo '<form method="post" action="simple_example.php">';
echo 'Website URL: <input type="text" name="url" value="http://webdeveloper.com">';
echo '<input type="submit" value="Next">';
}
else {
if ($web_html = file_get_contents($_POST['url'])){
preg_match('/<title>(.*)<\/title>/',$web_html,$title_matches);
$title = $title_matches[1];

preg_match('/<meta name="description" content="(.*)"\s?\/?>/',$web_html,$description_matches);
$description = $description_matches[1];


preg_match('/<meta name="keywords" content="(.*)"\s?\/?>/',$web_html,$keyword_matches);
$keywords = $keyword_matches[1];

echo <<<END
<style type="text/css">
label {width: 100px; float: left; text-align: right; margin-right: 20px;}
input {width: 500px; margin-bottom: 5px;}
.submit {width: auto; margin-left: 120px;}
</style>

<form method="post" action="simple_example.php">
<input type="hidden" name="done">
<label>Title:</label> <input type="text" value="$title"><br>
<label>Description:</label> <input type="text" value="$description"><br/>
<label>Keywords:</label> <input type="text" value="$keywords"><br/>
<label>Website:</label> <input type="text" value="$_POST[url]"><br/>
<input type="submit" value="Next" class="submit">
END;
}
}
?>