Results 1 to 4 of 4
  1. #1

    Idea or Suggestion Importing data from other website

    Is there a code to bring a page content into my website, i use Zen Cart and i have made a sidebox to hold pages from my directory (link exchange) i need the pages within the directory to be updated as new post have a been approved which happens on my other website

    can it be done? if so how?

    I will help if I can, Winners Design Studio

  2. #2

    Default Re: Importing data from other website

    i have found this but it just brings the source code how can i fix it fo it to post the html not the code.

    How to get(view) html source code of a website

    In this article, I will be illustrating about getting html source code of any website. I have done this in PHP.

    I created an html form for submitting the website url. After the url is submitted, the PHP code does all the magic to display full html source code of that particular website. The source code is displayed in a textarea.

    $domain = $_POST['domain'];

    $handle = fopen(”http://$domain”,”r”);

    //$contents = stream_get_contents($handle);

    $contents = ”;

    while (!feof($handle)) {

    $contents .= fread($handle, 8192);

    }

    fclose($handle);

    At first the website url submitted through the html form is opened with fopen(). Then, using while loop, the $contents string variable is populated (concatenated) until the end of file is reached. Finally, the file/url pointer is closed with fclose().

    You can also get all the contents without using loop. You can get it with the stream_get_contents() function. But this function is only supported by PHP 5+. stream_get_contents() operates on an already open stream resource and returns the remaining contents in a string. stream_get_contents() will not work in PHP versions lower than PHP 5. If you are using PHP versions lower than PHP 5, then better not use it.

    Description of functions used:

    fopen() opens the url. The mode used here (i.e. ‘r’) is read mode.

    feof() tests for end-of-file on a file pointer. It returns true if the file pointer is at EOF; otherwise it returns false.

    fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when up to length bytes have been read, EOF (end of file) is reached, (for network streams) when a packet becomes available, or (after opening userspace stream) when 8192 bytes have been read whichever comes first.

    fclose() closes an open file pointer.

    View it live

    Full source code:

    view plaincopy to clipboardprint?

    1. <?php
    2. if(isset($_POST['submit']))
    3. {
    4. $domain = $_POST['domain'];
    5. $handle = fopen("http://$domain","r");
    6. //$contents = stream_get_contents($handle);
    7. $contents = '';
    8. while (!feof($handle)) {
    9. $contents .= fread($handle, 8192);
    10. }
    11. //var_dump($contents);
    12. }</p>
    13. ?></p>
    14. <html>
    15. <head>
    16. <title>HTML Source Code Viewer</title>
    17. </head>
    18. <body></p>
    19. <h2>
    20. HTML Source Code Viewer
    21. </h2></p>
    22. <form method="post" name="pageform" action="" onsubmit="return validate(this);"></p>
    23. <table border="0" style="border-collapse: collapse" width="">
    24. <tr>
    25. <td width="" height="91" valign="top">
    26. <table style="border-collapse: collapse" width="" class="tooltop" height="76"></p>
    27. <tr>
    28. <td>
    29. <table border="0" style="border-collapse: collapse" width="" cellspacing="5">
    30. <tr>
    31. <td height="28" width="100"><font size="2"><b>View source of</b></font><b><font size="2">:
    32. </font></b></td>
    33. <td height="28" width="">
    34. <font size="1">http://</font><input type="text" name="domain" size="26" value="<?=$_POST['domain']?>"></td>
    35. <td height="28" width="">
    36. <input type="submit" name="submit" value="View!" style="float: left"></td>
    37. </tr>
    38. <tr>
    39. <td width="" height="21">&nbsp;</td>
    40. <td width="" colspan="2" height="21" valign="top"><font size="1">(eg. chapagain.com.np)</font></td></p>
    41. </tr>
    42. </table>
    43. </td>
    44. </tr>
    45. </table>
    46. </td>
    47. </tr>
    48. <?php
    49. if(isset($_POST['submit']))
    50. {
    51. ?>
    52. <tr>
    53. <td>
    54. <textarea rows="10" cols="60" name="code"><?=$contents?></textarea>
    55. </td>
    56. </tr>
    57. <?php
    58. }
    59. ?>
    60. </table>
    61. </form>
    62. <script language="JavaScript">
    63. function validate(theform) {
    64. if (theform.domain.value == "") { alert("No Domain"); return false; }
    65. return true;
    66. }
    67. </script>
    68.
    69. </body>
    70. </html>
    I will help if I can, Winners Design Studio

  3. #3

    Default Re: Importing data from other website

    Come on there have to be someone with the knowledge to let me know
    I will help if I can, Winners Design Studio

  4. #4

    Default Re: Importing data from other website

    Here I am playing by myself and is not working, i have even try this on EZ-pages which is what i have chosen to do my directory.

    Well, I have try also doing it with a frame, maybe there is something Wrong with the code because it keeps despairing on me, I put the code in and save the page go to the browser to see if it works, It didn't, come back to the administrator to see the edtor on the EZ-pages and the code is not in it. any takers?

    the frame code:


    <br /><br /><div style="margin-top: 0px; margin-left: 0px; margin-right: 0px;"><table cellspacing="0" cellpadding="0" border="0" align="center" width="100%" id="page">

    <tbody><tr>

    <td style="border-bottom: 3px solid black; height: 120px; vertical-align: middle; background-color: rgb(255, 255, 255);"><div style="text-align: center;">

    <!-- Put your header hear //-->

    </div><div class="style1" style="padding: 10px; text-align: center;"><font size="6" style="color: rgb(153, 0, 0); font-weight: bold;">Winners
    Hosting &amp; Design Studio</font><br style="font-weight: bold;" /><br style="color: rgb(102, 0, 0); font-weight: bold;" /><font size="5" style="color: rgb(153, 0, 0); font-weight: bold;">SEO Link Exchange</font><br /><br /></div>

    <!-- end of Put your header hear //-->

    </td>

    </tr>
    <tr>

    <td valign="top">

    <frameset rows="37,*" frameborder="0">
    <frame name="control" id="control" src="rjgonzalez_sites/food.html" border="0" frameborder="0" framespacing="0" scrolling="no" />
    <frame name="browser" id="browser" src="rjgonzalez_sites/food.html" border="0" frameborder="0" framespacing="0" />
    </frameset>


    </td>

    </tr>
    <tr>


    </tbody></table>

    </div>
    <br /><br />
    I will help if I can, Winners Design Studio

 

 

Similar Threads

  1. Importing coupon data from csv file
    By cravin2 in forum Installing on a Linux/Unix Server
    Replies: 0
    Last Post: 23 Mar 2011, 07:37 AM
  2. Importing Data From A Non-ZenCart System
    By JDTechnics in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 29 Jan 2010, 10:30 AM
  3. Importing Customer Data from Filemaker
    By Out2lunch in forum Managing Customers and Orders
    Replies: 3
    Last Post: 31 Oct 2009, 12:28 AM
  4. importing data from csv files
    By djdavedawson in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 May 2009, 09:46 PM
  5. Importing Product Data from CSV?
    By tjwalker in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 13 May 2007, 04:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR