Warning: Fopen(http://localhost/.. ?HTTP Wrapper Does Not Support Writeable Conn
I am able to create a pdf using php and ezpdf, its works fine, and display the pdf document in the current server page.
But here are two things i wish to do, first store the pdf and than open, if possible in a new popup window?
When i tried this function below, it gives me an error
Error:
Warning: fopen(http://localhost/pdf/files/tmp1/yasmina.pdf) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections. in C:Program FilesxampphtdocspdfpdfClassesAndFonts_009ecertificate.php on line 139
Could not open file to save PDF. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Http://localhost/test.php
I relatively new to PHP. Please help. I installed Apache, PHP. Then when I tried to test it by opening a test.php file with just the phpinfo() function in it doesn't execute the php file which is <? phpinfo(); ?> instead, sends it for download and when I tried the same with a different filename like test.php3 or test.php4.
View Replies !
Using 'localhost' With Apache 1.3 HTTP Basic Authentication?
I'm configuring a PHP script to use HTTP Basic Authentication. Thus, is it possible to test basic authentication using 'localhost'? If so, could someone send me a working .htaccess file because the following doesn't seem to launch the login dialog: AuthType Basic AuthName "TEST HOST" AuthUserFile C:/wwwroot/testhost/passwd/.htpasswd AuthGroupFile /dev/null <Limit Get> Require valid-user Order allow,deny Deny from all Satisfy all </Limit>
View Replies !
Apache Not Recognising Http://localhost From Browser
I have been using a local installment of Apache web server and PHP on my computer. For some reason it has stopped loading my local web pages when I enter 'http://localhost' into the browser address bar. For IE it displays a page not found and Netscape, it redirects me to Netscape search where it does a search for 'localhost'. I cant understand why it has been working and all of a sudden just stopped but is there anyway to fix this in configuration? My knowledge of apache isnt the best so
View Replies !
Being On Or Off-line Can Affect Variable Transfer In Http://localhost?
Is there any trick that I should know about when trying to get php files to display in http://localhost? I've been having trouble getting variables to pass from the php to the html page, but I swear it was working for a while there (couldn't believe it), but then, trying to figure out what had changed to make it work, I went on-line and all of a sudden, gone again. Variables not translating to the html. Now I can't get it to work again, and I don't know why.
View Replies !
Http Fopen Problem
I'm trying to write a script which downloads information from a number of websites analyses it and shows some results. The problem I'm having is that some sites seem to work perfectly while others don't. I know it's to do with the complexity of the site, but I've no idea how to fix it in my code. At the moment I am just using file_get_contents() to get all of the relevant pages, but when I use this on http://www.dontstayin.com it just doesn't work! when I go there with my browser and view the source it's all lovely html, but when I try to grab it file_get_contents() returns bool(false) what am I doing wrong, and how can I better emulate an actual web-browser?
View Replies !
Passing Variable To Another File Error: Http://localhost/story.php?id=1
The script below (list.php) retrieves data from a database to list article titles. By clicking the hyperlink, the article text is supposed to appear when accessing story.php based on the $id variable passed through to the file "story.php". However I get this error msg when loading story.php.: "Notice: Undefined variable: id in c:easyphpwwwstory.php on line 12." Address line shows: http://localhost/story.php?id=1 This means that the list.php script works, since this shows in the address line. However , the script which received the variable, does not recognize the id variable, why? Code:
View Replies !
Fopen() And Variable From HTTP Link
I’ve god a real issue with “fopen” function and variables from HTTP link… I just don’t see what’s wrong. Here’s the deal. I kind of try to create something like guestbook for my class project where users can open different files and write in them whatever they want: Code:
View Replies !
Server HTTP Sends Or Streaming HTTP?
I was wondering if you guys had any ideas to constantly stream a webpage in case an announcement was posted or possibly pushing onto the browser information. What I basically want is for a user browsing my website to be notified of any new announcements. I thought about checking everytime he changes pages but then I realized that I want them to be notified as long as they have the page open even if it's minimized. So it would at best be a method to use php force send a msg after someone posts an announcement.
View Replies !
Questions About HTTP Headers Sent With PHP In HTTP Authentication
Here is an example from the PHP Manual <?php if ((!isset($_SERVER['PHP_AUTH_USER'])) || (1==1)) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button' exit; } else { echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>"; echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</ p>"; } ?> Questions. 1. This is a status code not a header, right? = header('HTTP/ 1.0 401 Unauthorized'); 2. According to the change log in the PHP manual, starting with 4.4.2 and 5.1.2 the header function now prevents more than one header to be sent at once as a protection against header injection attacks. Does this mean if I make multiple header calls the headers will be sent in multiple response messages to the browser? Is this allowed? Can a server send multiple response messages to one request?] 3. If you hit the "cancel" button on the browser user name/password request dialog (as alluded to in the code snippet above), what message does the browser send to the server.
View Replies !
Fopen Url Wrapper
system: php 4.4.2 windows 2003 server apache 1.3.x problem: scripts don't work :-P description: $x='http://exmaple.com/file.txt' Either: $content=file_get_contents($x) Or: $fp=fopen($x,'r'); [ Would assume this as well: $content=file($x); ] When I attempt to access a script on a certain Win2K3 server that attempts to read a remote file using the fopen url wrappers, I get some strange results: Opera (nothing) MSIE (cannot be reached page [browser default thing]) Firefox (prompt to download) I sent a head request via lynx, and this is what I get (even after turning off windows firewall): Looking up example.com Making HTTP connection to example.com Sending HTTP request. HTTP request sent; waiting for response. Alert!: Unexpected network read error; connection aborted. Can't Access `http://example/test.php' Alert!: Unable to access document. Everything that I thought of checking in both httpd.conf and php.ini seem to be just fine. Does anyone have direction for troubleshooting this?
View Replies !
Warning: Main(URL): Failed To Open Stream: HTTP Request Failed!
I am getting this message when I try to get an include file remotely.. Warning: main(URL): failed to open stream: HTTP request failed! HTTP/1.1 200 OK in ... on line 25 Warning: main(): Failed opening '...' for inclusion (include_path='') in ... on line 25 It works some time's and not other times. I believe it is because the php file on the remote server is taking to long to process. Is there a way around this.... ie another way to process an include remotely and then have the results included in your program...?
View Replies !
301 Redirect With PHP Http:// To Http://www.
I'm trying to redirect http://domainname.com to http://www.domainname.com using a 301, on all pages, that means it needs to go in the header file... Here's the code I have: Quote# <?php # if(!stristr($_SERVER["HTTP_HOST"], 'www')){ # header("HTTP/1.1 301 Moved Permanently"); # header("Location: http://www.domainname.com/" . $_SERVER["REQUEST_URI"]); # exit(); # } # ?> The only thing is that it redirects every page to http://www.domainname.com/... including http://www.domainname.com/ How do I fix this? What's the solution? I'm assuming there's some more code that needs to go into it. The host doesn't allow me to do this in the htaccess file.
View Replies !
Error: Warning: Main(http://app.feeddigest.com/digest3/ODC9FIC36I.html) [function.main]: Failed To Open Stream: No Route To Host
I have a client which is seeing the following error from this code in WordPress: <?php include ('http://app.feeddigest.com/digest3/ODC9FIC36I.html'); ?> Error: Warning: main(http://app.feeddigest.com/digest3/ODC9FIC36I.html) [function.main]: failed to open stream: No route to host in /hsphere/local/home/user/mydomain.com/wp-content/themes/anaconda/page.php on line 18 Warning: main(http://app.feeddigest.com/digest3/ODC9FIC36I.html) [function.main]: failed to open stream: No route to host in /hsphere/local/home/user/mydomain.com/wp-content/themes/anaconda/page.php on line 18 Warning: main() [function.include]: Failed opening 'http://app.feeddigest.com/digest3/ODC9FIC36I.html' for inclusion (include_path='.:/usr/local/lib/php') in /hsphere/local/home/user/mydomain.com/wp-content/themes/anaconda/page.php on line 18.
View Replies !
Can't Include 'http...foo.php', But Can Include 'http...foo.txt'
This seems weird, but when I use the following code, include 'http://www.foo.com/includes.php' includedfunction(); I am told that it is a call to an undefined function, but 'includedfunction' is on the server. the following includes work fine, and the run the called function with no trouble: include 'http://www.foo.com/includes.phtml' include 'http://www.foo.com/includes.txt' all three include.php,.phtml & .txt are on the server and are exactly identical. I am running php version 4.1.1.
View Replies !
Warning: Fopen(static-front.html) [function.fopen]
We're getting a strange permissions error. We have a static html page that is dynamically generated only when its actually changed (as opposed to doing a lot of front end processing for every single visitor). The process works fine from the document root using include('page_name.php'), however from a subdirectory of the document root using include("../page_name.php") it does not work. The file is found OK, but when it tries to open the html file to write to it, it says "Warning: fopen(static-front.html) [function.fopen]: failed to open stream: Permission denied" The html file's owner is www-data (the user for apache) and it has write permissions for the file but when its included from a subdirectory, it somehow doesnt have permission?
View Replies !
HTTP Error And Parse Error - I Get HTTP, Friend Gets Parse :S
I have just finished making a script, which basically updates a users account depending on what button they pressed on the previous page, everything looks fine to me, but when I click a button, I get a big HTTP error page, but the strange thing is, when my friend press's a button, he gets a parse error. Code:
View Replies !
Mysql - Error Warning Cant Connect To Localhost.
simple problem i cant seem to sort out. i can login to mysql account through mydb studio windows program but i try to login through php script // Database Connection $connect = mysql_connect("localhost", "root", "admin") or die(mysql_error()); mysql_select_db("databasename") or die (mysql_error()); i get error warning cant connect to localhost.
View Replies !
HTTP 403
I have finally managed to get Apache 2.2.4, PHP 5.2.0 and MySQL to talk to each other. Everything seems to work OK when dealing with databases but as soon as I use a php-script that use $_server the browser will throw me away and give me HTTP 403. It has worked before but that was before I got the communication to work with MySQL
View Replies !
HTTP/URL
In cURL or Filesystem is there a function that will send data to a url. Like if I wanted to request a url with a specific string in the body how could I do this? I can't find anything.
View Replies !
Warning: Mail(): Failed To Connect To Mailserver At Localhost Port
I have windows xp pc and i have installed apache as a web server and php also working fine, but when i am sending mail, its giving me following error when upload same to linux live server its working, please help me what do i have to do for this Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:SafrasWebHosting....
View Replies !
Warning: Mysql_connect(): Can't Connect To MySQL Server On 'localhost' (10061)
i was coding a database script in php which uses mysql as backend, am not a newbie to either mysql or php, its been fun for years for me, but during my coding 5 mins before i just got Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) I was not connected to internet so no chance of virus or so, niether any chance of configuration change issue by someone, how can this happen at once? i restarted machine but still the same. I am on a windows server.
View Replies !
Http Or Https ??
What variable might i be able to extract the http:// or https:// from to detect which type it is? On my server i have $_SERVER['SCRIPT_URI'] which contains htis but my friend does not have this variable on his server.
View Replies !
HTTP Authentication With PHP
I have followed 3 different tutorials and none of them seem to work. When I use the following code in the beginning of my PHP script: if (!isset($PHP_AUTH_USER)) { header('WWW-Authenticate: Basic realm="Datacenter"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.' exit; } and I attempt to access the script I get the error: "Error 500: Internal Server Error" I reset the permissions to 755 and still no luck. I then, out of frustration created a .htaccess file and tried every possible combination, particularly in the UserAuthFile. I have tried, UserAuthFile [path]/myscritp.php4 UserAuthFile /dev/null/ I have also tried deleting the line alltogether and what happens in all these cases is that the box comes up but when I enter the info it does not send the variable to the script. If you have any information I would really appreciate it. I could even send you the script to look at the full code if it would help.
View Replies !
Http Auth + Php
Is it possible to get PHP to pass a login/password to an htaccess protected dir? This is to make a loginform for a page that resides in a protected dir. I want to avoid the normal login dialog the browser uses, so I amongst other things can give the user a few choices when logging in.
View Replies !
Http Or Www Replace
I wanted to know how to replace a URL when it is outputted. I tried to use the following: $output = ereg_replace('http://([[:graph:]]+) ', '[<a href="http://1">link</a>] ', $output); $output = ereg_replace('www.([[:graph:]]+) ', '[<a href="http://1">link</a>] ', $output); but it doesnt work properly, so i want one that replaces the URL when http://www.?.com or www.?.com and replaces with [<a href=http://www.111.com">link</a>] Would i have to use two of these but just in a different way or use one or even use a whole different function.
View Replies !
HTTP Authentification
I need to download an XML file from a website, but everytime I go to the URL, I need to authenticate(basic) via the http header. What kind of text should I send to do it via php?
View Replies !
HTTP Variable -
Say I type in an address in my location bar. I press enter and go to the specified page, say http://www.foo.com/foo-foo.php. HTTP_REFERER returns the referring page - which is very close to what I need, but it only works where the user clicked a link to get to foo-foo.php. If user manally enters the address, HTTP_REFERER is empty. Is there a way to get manually typed in urls? REQUEST_URI returns the actual page the user is on. For my application REQUEST_URI isn't what I need. I'm building an error page and I want a report of any pages users are trying to reach that are not found.
View Replies !
Http-get And Headers
I am looking to write code that can read a file from an http address (for example: http://www.somesite.com/document.xml) and check it for any changes (an updated state) then download it if it is a newer version. I have seen references to the http-get functionality of PHP , but can't find any examples or tutorials. Apparently I can check some http headers to determine whether the document is new or not? Can anyone direct me to some help on this issue?
View Replies !
Using A Http Proxy
I've been trying to get PHP to access all http data via a proxy server - this is the only way I can get anything from port 80 on my Uni connection. I've checked phpinfo() and the environmental variable http_proxy seems to be set, but fopen("http://...") isn't working... I really need to make this work.
View Replies !
Doing An Http Post
For the benefit of others, I want to show how to do an HTTP POST request using fsockopen(). I banged my head against a wall for two days trying to figure this out. I even went to http://php.net/ to find out how to do this, but it didn't help because my mind automagically converted the "Content-Length" header into "Length." I even went to find out the specific protocol for HTTP POSTs, but I didn't find it there. RFC 2616 (HTTP) does not give the exact format for POST requests. Question: Where is the format for POST requests defined? ---------------- send_post.php --------------- <?php // file: send_post.php error_reporting(E_ALL & ~E_NOTICE); $eol = " "; $errno = 0; $errstr = '' $data = 'username=george&password=i81bpz' $fid = fsockopen('localhost', 8080, &$errno, &$errstr, 30); if ($fid) { fputs ($fid, "POST /post/show_post.php HTTP/1.1$eol"); fputs ($fid, "HOST: localhost$eol"); fputs ($fid, "Connection: close$eol"); fputs ($fid, "Content-Type: application/x-www-form-urlencoded$eol"); // Use 'Content-Length' NOT 'Length' ! fputs ($fid, 'Content-Length: ' . strlen($data) . $eol); fputs ($fid, $eol); fputs ($fid, $data); fputs ($fid, $eol); fpassthru($fid); } ?> ------------- show_post.php ----------------- <?php // file: show_post.php error_reporting(E_ALL & ~E_NOTICE); echo "<pre>"; echo "------------ POST VARIABLES ----------"; print_r($HTTP_POST_VARS); echo "------------ SERVER VARIABLES ----------"; print_r($HTTP_SERVER_VARS); echo "</pre>"; ?>
View Replies !
HTTP Expire
I want to cashe database driven forum, but SESSION is used for passing userID. When I use code below offline browsing is ok, but session variable is difrent on cashed pages. Some pages stored gost id some admin. How can i solve this. <?php ob_start(); session_cache_limiter('private'); header("Cache-control: private"); header("Content-Type: text/plain"); header("Pragma: public"); session_start(); ?> <!-- SADR®AJ --> <?php ob_end_flush(); ?>
View Replies !
Http Referer?
I'm bulding this web site and I do not want other to link to my pages. I can use on every sinle page the http_referer to detect who's the referer and decide if I have to give access or not... but isn't there a better way of doing this instead of putting a piece of code on very single page ?
View Replies !
FsockOpen With Http 1.1
I have the following code that needs to be transferred into HTTP 1.1 I am running on windows and wondered if this is an easy undertaking and what to beware of from user experience. PHP Code:
View Replies !
Include Using Http://
i am using include("http://".$_SERVER['SERVER_NAME']."/db.php"); to include a file. It isnt returning anything or connecting to the database (which is what it is supposed to be doing). any ideas? if i put in the path to the file it works, but I need it to do it over http the rest of the code is being run over a symbolic link and I need different connections per website.
View Replies !
Http-Download
I want to load a file from a foreign server down in a certain directory of my webserver. How ? It's no ftp-download.
View Replies !
Getting Files Over Ftp/http
Before I go on a mad quest to try to code some pages, I think it's probably prutent to ask something. If I were to pass a php page either an ftp or http address of an image file (assuming it had a username and password coded in), would I be able to make it go and get that file and save it in a folder local to that page?
View Replies !
Http Headers
[x-posted here and there] Excuse me if this is OT here. I'm trying to find out what would happen if I append my: Content-Type: application/x-javascript Content-Length: nnn <javascript data> To an http answer in transit. 1) Does appending such a thing to an http answer which already has it's own content-type and length headers and data, is allowed ? 2) How would a typical browser understand it ? Would it just ignore it ? If the answer to (1) is "no": what would you suggest to do ? I've thought of capturing the stream, and creating multi-part. The first part would be the captured one, and the second - the data I want to append. Does it seem as a good scheme to you ?
View Replies !
Run A Php In The Background Using Http
i have a script (script1) which needs to call another script (script2). It should not wait for the answer, so script2 should run in the background. I really need to call the php script using: http://urlof myscript/script2.php I don't want to use it as a cgi and use CLI. I did a test with fsockopen and curl and a timeout of 10 seconds and call http://urlof myscript/script1.php from my browser: Script1 stops after 10 seconds => OK Script2 has been called by script1 and continue to run in the background =>OK After 60 seconds Script2 is killed by php!! => KO :( The script is working fine if i call http://urlof myscript/script2.php from my browser. It needs around 120 seconds to finish. Why is it stopping after 60 seconds when I use fsockopen and call it from script1? Here is the script in SCRIPT1: $fp = fsockopen("$host", 80, $errno, $errstr, 30); stream_set_timeout($fp,10); if (!$fp) { echo "$errstr ($errno)<br /> "; } else { $out = "GET $path HTTP/1.1 "; $out .= "Host: $host "; $out .= "Connection: Close "; fwrite($fp, $out); $status = socket_get_status($fp); while (!feof($fp) && !$status['timed_out']) { echo fgets($fp, 128); $status = socket_get_status($fp); } fclose($fp); } I have added this in SCRIPT2: ignore_user_abort(FALSE); // becareful, FALSE really means it should ignore user abort !!! set_time_limit (120); ini_set("max_input_time",120); ini_set("max_execution_time",120); Do you have any idea?
View Replies !
Http To Https
i have a page which is a application form and should be in https. it also works with http. is there any script to redirect the page to https when the request is from http?... the server is IIS. i want only that page to be in https and dont want the whole site in https.
View Replies !
Get The 'http://' Section From The Url Bar..
I'm sure this is really simple, but I'm trying to get the full url from the address bar. I'm using this: $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];which works fine except I'm wanting to check whether the page is 'http://', 'https://' or even 'ftp://' and add that to the beginning. At the moment I get something like: www.mydomain.com/folder/index.php
View Replies !
HTTP Header
I've got a question concerning the headers sent by the client accessing your page. I have found there are several variables accessible in PHP: $_SERVER['REMOTE_ADDR'] (which should not be determined by any HTTP headers, but by the web server reading the TCP/IP headers, right?) $_SERVER['HTTP_VIA'] (which will be filled if there is a transparent proxy) the above are pretty clear and cause no problems. But when you continue to search for headers that can possibly be sent by a client (may it be a proxy or not), it's getting very confusing: $_SERVER['HTTP_X_FORWARDED_FOR'] $_SERVER['HTTP_CLIENT_IP'] $_SERVER['HTTP_PROXY_CONNECTION'] $_SERVER['FORWARDED_FOR'] $_SERVER['X_FORWARDED_FOR'] $_SERVER['X_HTTP_FORWARDED_FOR'] $_SERVER['HTTP_FORWARDED'] I mean, they all seem to denote the SAME thing. Why use SEVEN different headers for that? Were the guys who wrote the RFCs bored? Why confuse people with so much possible headers, when it could be in ONE SINGLE header? Apparently this is not a PHP problem, since PHP just fills these variables by reading the HTTP header lines (X-Forwarded-for: , X-Forwarded: , ...) sent by the client. I have googled for all of those, but opinions seem to differ on what header line should be taken into account and what header line shouldn't. So, 1) Why are there so many possible headers? Are some of them obsolete? 2) What is the difference between those headers with a 'X' and those which lack the 'X'? 3) What is the difference between "FORWARDED_FOR" and just "FORWARDED"?
View Replies !
|