开发者

If i enter a website link in a text box and submit i need to get that specific website detais. Similarly like facebook link module?

If i enter a websi开发者_Python百科te link in a text box and submit it i need to get that specific website details. Similarly like facebook LINK module?

Any help will be thankful

Thanks in advance

Fero


You can try this:

<?php
   $page = file_get_contents('http://www.example.com/');
   echo $page;
   //do some stuff with $page
?> 


When the user enters a valid link on the text box, AJAX request back to your website to crawl the requested website for details. Then the AJAX can return details about the website back to the form.


I would recomment to use a framework like jQuery. With jQuery you would simply:

$("#website_submission_form").submit(function() {
    $("#website_submission_form .ajax-loader-animation").show(); // Show the user something is going on...
    // You could get an animation here: http://www.ajaxload.info/

    $.ajax({
        type:       "GET",
        url:        $("#website_submission_website_input_field").attr('value'), // Warning: No parsing/validation of entered value has happened so far!
        data:       null,
        success:    function(data, textStatus) {
            parseWebsiteForImgTags(data); // data contains the website html source
        },
        error:      function (XMLHttpRequest, textStatus, errorThrown) {
            alert('Something went wrong: ' + textStatus);
            $("#website_submission_form .ajax-loader-animation").hide();
        }
    });

    return false;
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜