Code To Read A Web Page
How can I read another web page in php. I tried:
$url = 'http://www.yahoo.com'
$contents = file_get_contents($url);
echo $contents;
but I get an error: The specified CGI application misbehaved by not returning a complete set of HTTP headers.
View Complete Forum Thread with Replies
Related Forum Messages:
Can People Read Php Code From Web?
I'm wondering how secure is it for people to read the php code from website? What about the encoder like Zend Encoder (too pricy)? why do they provide encoder if the php code is invisible to people w/o encoder? let's say my code here, i don't want to show 123.456.789.123 to anybody if people can read/hack the php code. PHP Code:
View Replies !
How To Read Source Code
I downloaded the PHP 5 source code from www.php.net web site. It is a tar compressed file. I used WinZip to unzip it. Now I got a whole bunch of files. But I do not know to read these files. Do I use Visual Studio, or any other IDE tools? Or do I must use a text editor to open each file individually to view it? And, by the way, what is Zend? Is it a ( free ) IDE tool?
View Replies !
Code To Read Emails
tell me the code to read emails. i mean mails in my varspoolmail folder using php - (imap) and display in a html page. Can i use imap for this. i am hosting a email web server like hot mail.
View Replies !
Pass The Variable From 1st Page And Read It With Other Name On 2nd Page
I am new to this and learning slowly, but I was hoping someone could give me some quick advice on how to create a variable on one page and have it passed to another to be read as an ID for a mySQL database. I want to pass the variable "varRevID" from one page and have it read as "reviews_id" on the other. My database is pulling from just the first record and I would liek to designate from the pointing page which record to pull from.
View Replies !
How Can I Avoid My Code From Being Read By A Customer?
Here's the situation: A customer of ours (say: A) wants to have a dynamic webpage designed for a customer of his (say: B). B shall not be able to read or edit the code. I told A that this is not possible as PHP is a script language which is not compiled before execution. In addition, the concept of using an OpenSource Product to design sites which use code that is supposed to be not open at all xxsses me of completely, but thats another topic. However, Is there any way, except of .lib files which are written in C, to hide ones Code? Do not hesitate to discuss the general question wether it should be done, at all. Even When you'll find I'm of your opinion...
View Replies !
Php Function To Read Local Python Script Output, Not Code
On my server python has to run in the wwwroot/cgi-bin folder, but php can run anywhere. My site is going to be written in python but I don’t want my user to see the url as mysite/cgi-bin/... . So for example my homepage, index.php should contain a simple php script that will get my python page from the cgi-bin directory and display it. However when I try to use SSI or fopen/file_get_contents/readlink and commands like these it just displays the python code. Where as when I visit the python page in my browser it runs it and displays the output for me. My question is what php function can I use to execute my python page and return the output, not the code itself. (I think my hosting provider has disallowed certain powerful commands like system() etc. Does this make it impossible?). As the very least can’t my php script pretend to be a www user and ‘visit’ the python page to read the output?
View Replies !
Is It Possible To Read ASP.NET Web Page In PHP?
Is it possible to read another web page in PHP? If is ASP.NET, the code would be ------------ WebRequest req=WebRequest.Create("http://www.microsoft.com"); WebResponse res=req.GetResponse(); StreamReader sr = new StreamReader(res.GetResponseStream()); String Output=sr.ReadToEnd(); Response.Write("The content is : " + Output); --------
View Replies !
Read A Web Page
i want to store(read) the contents of a "web page" into a file. how can i do it in PHP. Please help me. The web page contains a table. i want to fetch & store the contents of that table into a file.
View Replies !
Read A Web Page And Then Display
I'd like to read a webpage, the parse it and display a small part of it. Here is what I've tired. It isn't working. <?php $handle = fopen("http://www.yahoo.com/", "r"); $contents = fread($handle, filesize($filename)); echo $contents; ?>
View Replies !
Q: Read Text With VBA From A PHP Web-page
I created a page on our intranet that shows a number and that increases for every time the page is opened. It is similar to a visitors-counter. When I look at the page with Internet Explorer it works just fine. Now I want to read this web-page from a MS-Word macro and include the number as a company wide unique id in my MS-Word document. Unfortunately, the PHP script doesn't update the counter when I call it from my MS-Word macro. How can I force PHP to update my counter when I call it from a VBA macro? I am using the following code:
View Replies !
Read An HTML Page
It may sound kind of crazy, but I'm trying to see if there's a way php code can 'read' contents of a static HTML page and store the contents into a variable. Is it possible? If so, how?
View Replies !
Load Page Then Read
Is there a way to completely load the page of its HTML elements then read all those elements into a string? For example, I have a PHP page that get its HTML content from the database. I want that page to completely loads, ie., get the content from the database, then write all of that page's text and html elements into a string so I can modify it (ie. remove all the links) to display it in another page.
View Replies !
Read Previous Page Url
I have a query regarding browser url.Let me narrate the exact scenario which i need. I would like to expire my session when a person enters different url in the navigator bar other than my url and comes back to my url. For example if i visit example.com and then i type gmail in the same navigator bar and then move back to my url example.com through browserback button then i have to end the session of my client i mean he has no more access to my site. The same scenario is there for icicibank.com. I wanna the code using php and javascript.
View Replies !
Read Page To Variable
I have tried tons of functions but none works the way I want. I have a page foo.php. Then in that I set a couple of variables. Now, if I include foo.inc.php that file can use all of these variables. Code:
View Replies !
Read Data From External Page?
I have tried to think of a solution to this problem, but i can't find it. My question is: If possible, how do you from your own page confirm that a form has been send from an external page?
View Replies !
Page Not Read By Conditional When In Sub Folder
I'm using some php conditionals in included footer. I identify some pages at the top with - $page='alt_footer' then have a conditional in the footer.php, like - if ($page!='alt_footer') { All works great, but if I put the page in a sub directory (making path adjustments for the includes), it is not recognized as having $page='alt_footer' All path relationships between the page (in sub folder) and the includes (in folder at same level as sub folder) work fine, just the conditional (from the include to the page) is not recognized.
View Replies !
Can't Read Remote Web Page From Local Apache/PHP
I'm trying to read the contents of any Web page on another host. I'm finding that... echo file_get_contents( 'http://www.php.net' ); .... works fine if I upload the PHP script to my Web host, and run it there. But if I run it on my PC, which is running Apache 1.3.33 (Win32) and PHP 5.0.5, then it always times out, and gives me the error message... [error] PHP Warning: file_get_contents(http://www.php.net) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. I get the exact same results using... $fh = fopen( 'http://www.php.net', 'r' ) or die( $php_errormsg ); while (! feof($fh)) { $page .= fread($fh,1048576); } fclose($fh); echo $page; Anyone know what could cause this to happen?
View Replies !
Read The Page Of The Site & Rerturn The Contents Of MEMBERS_URL & MEMBERS_NUMBER
a line on my site reads MEMBERS_URL="my2ndsite.com" MEMBER_NUMBER="12345" . Im Trying to read the page of the site & rerturn the contents of MEMBERS_URL & MEMBERS_NUMBER, but i cant get it to work can anyone suggest where ive gone wrong please PHP Code: $myfile = file("http://www.mysite.com"); foreach ($myfile as $row=>$data) { if (preg_match('/MEMBERS_URL="(.*?)" MEMBERS_NUMBER="(.*?)"/',$data)) { echo $data[1]; echo $data[2]; } }
View Replies !
Email With Attachment - Annot Be Accessed. The File May Be Read-only, Or You May Be Trying To Access A Read-only Location.
It is a basic email with an attachment. The email and attachment are getting sent and received ok. When the recipient tries to open the attachment, the right application opens (eg. Excel) but then throws up an error. I am using base64 encoding. For example: .xls file with base64 encoding: 'testing.xls' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding. .pdf file with base64 encoding: There was an error opening this document. The file is damaged and could not be repaired. so the file isn't being decoded right. I have tested on Yahoo and Outlook. PHP Code:
View Replies !
Code The Page That Will Actually Do The Deletion
how to code the page that will actually do the deletion, but im having problems figuring out how to get the information there. I know this is probably a simple solution, but Im stumped. How get my form to be able to be sent to 2 different pages depending on what button is pressed? Or can i use two forms on the page and just use _GET or something in the second one to pull the ID?
View Replies !
Display Code On Page
I have some information (php code) stored in a database and I am trying to grab it out and display it to my visitors. The problem is that the when I try to display: <? include 'file.php' ?> My page actually goes ahead and includes that. I looked at the source code of other posts here on phpfreaks and it looks like the "code" command replaces > and < with > and < How can I do the same?
View Replies !
Sending Code To Another Page.
I've done a form, with name etc, when they push submit then they come to a page where it stands their name etc. now i wan't that info to be sended to a diffrent page so i can look at it later, just like in a questbook. whats the code for it? Only the send code now i don't need how to write the info code=).
View Replies !
Code Just Prints Out To The Page
This might sound like an easy question but im stuck, in the website im building i want to store php code snippets in a table on the database and call them when i need them. When i try and put the code onto the site though the code just prints out to the page, can someone tell me what im doing wrong, is there a function i need to use to make it act as php code or am i just barking up the wrong tree.
View Replies !
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code that I've changed multiple times to try different things. I would think this is pretty standard fare so I'm not sure why I can't seem to get it right. What I would like to see happen: The code opens the directory and loops through the files, opening them and processing them. What is happening: If I hard code the name of one particular file (it is always the same file) in my test setting, fgetcsv does not return false and the code runs fine. The file is parsed and all is well. However, if I let the code open a directory and then loop through the files, this one particular txt file does not work. For debug purposes, I have it displaying each file name and it can display the name, it just won't process it. I've even tried setting a for loop and hard coding each file name (since right now I know the names - I won't in the future) and the file is processed. It is only when it is set to my $file var dynamically rather than being hard coded. Here is the code: $handle_dir = opendir('../directory_name'); /* loop over the directory. */ $countfile=0; while (false !== ($file = readdir($handle_dir))) { $countfile++; $filevalues = ""; //Skip the first two files that where found because they are "." and ".." if ($countfile 2) { //echo $file; //begin loop through each file name $handle = fopen($file, "r"); echo "Filename is: $file<BR>";//at this point the code can print the file name if (false == ($filevalues = fgetcsv($handle,6021,','))){ echo 'problems<br>'//for one particular file, this always displays }
View Replies !
HTML Editing Of .php Code Page ?
I run a few web pages that contains php code that was written for me by someone else. By reading his original code I have leaned a little and have made the occasional change. I would like now to add some basic html to the page and prefer to use HTML editing software to accomplish the task. I have run it to problems however. If I use Mozilla HTMl editor in WYSWYG mode , any changes I make do not work. After I upload to my server, all I see is a web page with mostly the raw php code. I tried Page Breeze HTML editor and it will not load .php files in to its WYSWYG editor. So, any changes I make have to be done in raw source code mode, a rather laborious task for this inexperienced HTML person. Is there anything that would made the task of adding HTML to a php page , easier ? I'm not attempting to add anything in to the main body of php code, just mainly looking to add some html tables with images preceding the start of php scripts, or after php scripts.
View Replies !
Switch Code For Search Page
I had made a very simple search page about a year ago and now I'm trying to add a couple of things and the first step was to add the ability to search by user. I thought I would use a switch command to select the query and then fill my table based off of the selection. Code:
View Replies !
Code Makes A Blank Page?
I upgrade from PHP4 to PHP5.4.2 and now this code doesn't work. I moved the header command up to the top (you can see where I commented it out lower in the code) and now all that show is the header. If I have the header in the original position the page is blank. Code:
View Replies !
Redirect Code Gives Blank Page
I have a simple piece of code designed to register a bookmark in an arrray during a customer site visit. The page should update the arrray and redirect but I get only a blank page. I dont get error messages and this basic code works in a similar application. Code:
View Replies !
Parsing PHP Code In An HTML Page!
I am trying to run PHP code from an HTML file. In my HTML file I have the following code: <?php include("<counter/counter.php");?> Now I have read several threads here on Webmaster World, and I have concluded that I need to create a ".htaccess" file, and place the following code in it: AddType application/x-httpd-php .php .htm .html But, once I have done this, every time I visit a page on my site, I get the Open/Save this file dialog. It seems like the server is telling my browser, to open all HTML files with the external application called "application/x-httpd-php". Code:
View Replies !
View The Source Code From A Php Page
Is there a way to view the source code from a php page and see the php? If there is, isn't that really bad? Aren't there a lot of websites out there that could be really messed up if someone could see the php part of the page?
View Replies !
Code To Check If Page Was Refreshed
i need to check if page has been refreshed and if it has i don`t want the code below to be executed. $sql = "UPDATE " . USERS_TABLE . " SET user_travel = user_travel + 1 WHERE user_id = '" . $userdata['user_id'] . "'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update travel', '', __LINE__, __FILE__, $sql); }
View Replies !
Code/page To Be Password Protected
I need the following code/page to be password protected and wondered how I should go about doing it? $entryID = $_GET['id'];     $query = "DELETE FROM `bkah` WHERE `id` = '$entryID' LIMIT 1";     mysql_query($query);     //redirect to showcart page     header("Location: index.php");     exit;
View Replies !
Read (and ONLY Read) A Multi-sheets Excel File With PHP.
I want to read (and ONLY read) a multi-sheets Excel file with PHP. I found so many scripts on the net that I finally don't know what to choose so... could experimented users help me to directly find the one that I need ? Here are the two obvious things the script must match : - free - can read multi-sheets Excel files
View Replies !
Dynamic Page HTML Code Question
I'm gonna have all my pages load up a dynamic header and footer, depending on what variable I call up. So at the beginning of my code it will call for a banner, this banner will be set as a variable in a seperate page that i'll call up. Now i'm wondering, can the page I call up (with a list of variables) have HTML code in it, like this:
View Replies !
Displaying Html Code On PHP Generated Page
I am trying to create a link page in my php application. this is a page that will display a block of html code that a visitor can copy and paste into their web site to create a link back to mine. My PHP page has a line in it like this: define('TEXT_INFORMATION', '<html page code is here>'); I have added the html code to create the page as noted above. the page contains a same of the banner image file and the html code that goes alon with it. My problem is that I haven't been able to "quote" the html code so that ir will not be executed. every time I try to run the application from my web server my page will display two copies of the banner iimage not on banner image and text block like it should. Any suggestions?
View Replies !
PHP Code To Access Password Protected Page
I have written the following HTML/PHP code to validate and provide access to a password protected page to users who are given the user ID and password through a separate e-mail. The required page, Articles.html, however does not load when the valid user ID and password is provided. Instead, the response is a blank page. validate.php <html> <head> <title>Login Authentication</title> </head> <body> <?php if (($_POST["username"]=='cutedog')AND($_POST["password"]=='puppy')) { header("Location: http://www.domain.com/Articles.html"); exit(); } else { echo "Login denied to the page - Articles.html"; } ?> </body> </html> Does any other file need to be included for HEADER function to work? I currently do not have CGI or SSI active on my hosting account. I am using the following HTML form for the user to submit the user ID and password to access the password protected page. <html> <head> <title>code</title> <script LANGUAGE="javaScript"> <!-- function validateForm() { with (document.saveform) { var saveit = true; if (username.value.length < 4) { alert ("Username too short. The username must be at least 4 characters in length."); username.focus(); username.select(); saveit = false; } if ((password.value.length < 4) && saveit) { alert ("Password too short. The password must be at least 4 characters in length."); password.focus(); password.select(); saveit = false; } else if (saveit) submit(); } } //--> </script> </head> <body> <form ACTION="http://www.domain.com/validate.php" name="saveform" METHOD="POST" align="center"> <div align="center"><center> <table border="0" width="93%" cellspacing="0" cellpadding="0"> <tr> <td width="52%"><div align="center"><center><table border="0" height="59" width="310" bgcolor="#808080" cellspacing="1" cellpadding="0"> <tr> <td width="248" height="19" bgcolor="#C0C0C0"><div align="right"><p><font color="#000000"><small>Add Your test username:</small></font></td> <td width="123" height="19" bgcolor="#C0C0C0"><div align="left"><p><input NAME="username" VALUE SIZE="8" MAXLENGTH="16" tabindex="1"></td> <td width="47" height="19" align="center" bgcolor="#C0C0C0"><div align="center"><center><p><a href="javascript:alert('The username must be between 4 and 16 characters long.')"><small><small>Help</small></small></a></td> </tr> <tr align="center"> <td width="248" height="17" bgcolor="#C0C0C0"><div align="right"><p><font color="#000000"><small>Add Your test password:</small></font></td> <td height="17" width="123" bgcolor="#C0C0C0"><div align="left"><p><input type="password" name="password" size="8" tabindex="2" maxlength="8"></td> <td width="47" height="17" align="center" bgcolor="#C0C0C0"><a href="javascript:alert('The password must be between 4 and 8 characters long.')"><small><small>Help</small></small></a></td> </tr> <tr align="center"> <td width="248" height="1" bgcolor="#C0C0C0"></td> <td width="123" height="1" bgcolor="#C0C0C0"><div align="left"><p><input TYPE="button" NAME="FormsButton2" VALUE="submit" ONCLICK="validateForm()" tabindex="3"></td> <td width="47" height="1" align="center" bgcolor="#C0C0C0"><a href="javascript:alert('Click to save the details')"><small><small>Help</small></small></a></td> </tr> </table> </center></div></td> </tr> </table> </center></div> </form> </body> </html>
View Replies !
Format Source Code For Displaying On A Web Page
Is there a good function or plugin out there to format my source code examples? I'm writing an article for a web page and want a very simple source code formatter. Eg: code in black, comments in red, quoted items blue, key words green, class names bolded.
View Replies !
Shows Code Doens't Display Page
When I try and view a page I installed with full permissions to my wwwroot directory it shows the code of the page it doesn't display the website.. I'm using IIS 5.1 with the newest PHP and MYSQL.. any ideas??
View Replies !
Print Code With Line Number On Web Page
I read HTML code from a url and I need to replace 'Beginning of Line' and 'End of Line' with line number. However, I do not know how this can be done. Any help would be really appreciated. $enews = file_get_contents("http://my.sony.co.th/newsletter/issue/issue-MySony061aug22/index_en.html"); $enews = htmlspecialchars($enews); print "<pre>$enews</pre>"
View Replies !
Preg_Match Source Code On Current Page
The problem is that if I set the variable $page_check to a file on our server to test it, every thing works as it should. But then when I place the script in a template file where the $page_check variable is set to $phpself - when loading a page with the script on I get firefox giving me a download box to download the current page file. So I figure I cant request a page to fopen a url which is the same url the script is on? So my question is how do I set up this script so it looks at its own source code, does a preg_match to find out what section its in? Code:
View Replies !
|