Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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 Complete Forum Thread with Replies

Related Forum Messages:
FSOCKOPEN - Http POST Request
I have made a php function to send a POST request to a cgi program. It works fine when the length of the parameters is short. But when the parameters goes REAL long(say 3000 chars), the web server return an error message:

(apache error.log)
[Mon Apr 01 15:20:13 2002] [error] [client 127.0.0.1] Premature end of script headers: c:/somepath/mycgi.exe here is my code:

View Replies !
Weird HTTP Response In Fsockopen
When I am submitting some data from the original Page. I get only the HTML output. But when i submit to same page with PHP fsockopen from my own script. It shows me the output added with something like this. Code:

View Replies !
How To Forumulate HTTP Request Using Fsockopen() / Fputs()
I am trying to get the file referenced by the following url:

I'm using parse_url to get the host, path, and query. My call to
fsockopen() works correctly. Unfortunately, I can find no documentation for
how to construct a request that will correctly instruct the server (i.e.,
waterdata.usgs.gov) to send me the file and all the combinations of strings
hasn't worked.

Can someone point me to some documenation that will explain how to construct
the query such that file can be obtained? A pointer to code snippets would
be useful as well, although I would really like to understand the precise
semantics.

View Replies !
Fsockopen() Sending HTTP POST Header
I recently learned how to use fsockopen() to send a POST HTTP header and read the response, and I have done this successfully to get a rate zone table from the UPS Web site, having sent the origin ZIP code as one of the variables.

I am now working on a completely separate project and trying to send a POST header to a test page on the server on which I am developing, and I have run into a snag. The fsockopen() function is connecting to the page specified in the POST header, but it doesn't appear to be receiving any of the variables. Code:

View Replies !
Warning: Fsockopen() [function.fsockopen]: SSL: Connection Reset By Peer In
I keep gettin this error when i submit on the form hosts say its all ok for them but isnt for me

Warning: fsockopen() [function.fsockopen]: SSL: Connection reset by peer in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

Warning: fsockopen() [function.fsockopen]:
php_stream_sock_ssl_activate_with_method: SSL handshake/connection failed in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

Warning: fsockopen() [function.fsockopen]: failed to activate SSL mode 1 in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

View Replies !
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 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 !
Add A 301 Redirect To Move All Access From Http://a.com To Http://www.a.com
I'm currently using the following .htaccess code:

RewriteEngine on
RewriteBase /
ReWriteRule .htaccess [F]
RewriteRule ^([a-zA-Z0-9/-]+)$ index.php?url_path=$1

And I'd like to add a 301 redirect to move all access from http://example.com to http://www.example.com. How can I do it, keeping the current rewrite rule?

View Replies !
Trapping A File Error: Failed To Open Stream: HTTP Request Failed! HTTP/1.1 404 Not Foundin
php
Warning: file(http://shop1.outpost.com/product/5053975)
[function.file]: failed to open stream: HTTP request failed! HTTP/1.1
404 Not Foundin

I am just trying to put some code around this to trap it.

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 !
Using Fsockopen()
While using fsockopen(), to check a URL using:

$fp = fsockopen("$url", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "<br>The Link (URL) could ot be validated<br>
<b>You entered: $url</b><p>
<a href="../auth/user_edit.php">Please try again</a><p>";
exit();
}
else
{
// then it was successful!
fclose($fp); // and carry on
}

It does the job as expected
My message is displayed but also the following warning:

Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.asdfghjkl.com:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in C:wampwwwaaaaaurllinkssubmit_url.php on line 106

The rest (my message) is fine and required:

View Replies !
Fsockopen()
All variables are defined and the 'else{ $sendbody = ... blah, blah, blah,.... mail(vars) } works. It only has problems when the mail server is a remote host or I am attempting to connect via IP rather than use the mail command. If the first section is correct I am connecting, just not finishing session ($text91 says unable to connect, blah, blah, blah, etc...). Code:

View Replies !
IIS Fsockopen
My code here accesses an IIS server and returns

HTTP/1.1 400 Bad Request Server: Microsoft-IIS/5.0 Date: Fri, 16 Apr 2004
10:36:56 GMT Content-Type: text/html Content-Length: 87 The parameter is
incorrect.

what am i doing wrong? does anyone know what a valid http post header for
IIS would look like?


<?php
$fp = fsockopen("www.suedtirol.info", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />";
}
else
{
$out = "HEAD /XmlApi/Demo/SeekEngine.Get http/1.0";
$out .= "Host: www.suedtirol.info";
$out .= "Connection: Close";

fputs($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
//php fsockopen IIS error
?>

View Replies !
Fsockopen And SSL
I'm trying to open a socket to a web page that uses SSL. If I specify port 80 (obviously wrong, I know), I get an error stating that the page uses SSL, and that I should use https:// to specify the address. Of course, since I'm trying to open the page using fsockopen this doesn't help.

If I specify port 443 the script just times out. When I try the same script on a non-SSL page using port 80 it works great, so I know the basic script is ok. Is there any way to specify that you want to connect securely in the HTTP request header? I've been looking for info on this everywhere and haven't had any luck.

View Replies !
Fsockopen() Help
I'm trying to open, read and extract information from a website
(maximum and minimum temps from
http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt )... Could
anyone give me some direction in how to do this? Below is the code I
have written but i keep get given an 'invalid stream resource' error

<?php

$page = "www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt";
$time_limit = 60;
$file = fsockopen($page, $errno, $error, $time_limit);
if(!fp){
echo("Connection failure");
}
else
{
fputs($file, "GET / HTTP/1.0

");
while (!feof($file)){
$data[] = fgets($file, 1000);
}
fclose($file);
}
?>

View Replies !
Fsockopen Uses?
im interested in learning more about the fsockopen function, what are
some of the typical uses for this function?

View Replies !
PHP + Hi5 + Fsockopen
I need some ideias on this problem, it looks like this:

* I need to have a script that logs in hi5 with a given username/password [This one is already working]

* Then uploads pictures to the given username profile [??]

My doubt is, how can I keep the 2nd part of the script logged in so I can upload my picture? I need to do this with sockets, not using curl functions.

View Replies !
@fsockopen
here about time out settings.

@fsockopen ("IP", PORT, $errno, $errstr, .2)

Is the .2 a timeout length?  If so what are the limits on the value?  ex: .1 - .9 .

View Replies !
Should I Use Fsockopen Or Something Else?
Currently I am making a "tool" :) that will grab some websites source code and will search for a specified text (e.g. javascript codes) in it. I am using fsockopen function for connection to a website and it works great if the websites location is normal.

E.g. if the website starts at www.example.com then fsockopen works fine, but if the website uses auto-redirect(via Location header field) to www.example.com/en/ or www.example.com/login.php then it doesn work. It only shows the redirect pages headers.

Maybe you have some better ideas how to grab websites source code? I've heard that fopen is not working remotely with most servers..

View Replies !
Fsockopen
is there any way to test if fsockopen command is available to be used on my hosting server? my web hosts advise me that it is up and running (I had to pay extra to get a dedicated server to get the function) but im not too sure as I cannot connect to grab shoutcast stats using the function with a script i already have, which is my goal (I run a internet radio site), however if i upload exactly the same script to another server i use for another site to test it, it works without problem.

View Replies !
Fsockopen Via Ssl
I'm having issues attempting to create an ssl connection using fsockopen. my code contains the following line .

fsockopen("ssl://siteaddr",993,$errno,$errmsg,20);

error message reported:
Error: unable to connect to ssl://server.name.tld:993

When i tail the logs on the remote machine i see no connection attempts from the web server. it appears to die before attempting to make a connection attempt. Code:

View Replies !
Fsockopen Won't Timeout...
Hi,

i am using the following code to check a few ports on a few servers to see if they are up or down. But they never seem to time out, can someone tell me what to do pls?

View Replies !
Parse_url() And Fsockopen()
When i parse a url and use it in fsockopen() to retrive a file header sometimes i get an error that just keeps printing itself down the page until i hit "STOP" on my browser. It only happens when the url is something like:

http://sub.domain.thing.com/dir/folder/file/name.ext

with many subdomains and folders....How would i stop the error from occuring and possibly fix the problem?

View Replies !
Telnet Using Fsockopen
I'm trying to telnet to a router to do a ping or trace job and retrieve the results. I tried this. PHP Code:


View Replies !
Fsockopen Problem
Hi, I am trying to complete a post using fsockopen but I'm getting the
following error:

"Unable to find the socket transport "ssl" - did you forget to enable
it when you configured PHP?

I am running php 5.1.4 with apache 2 on fedora core 4. When I
configured php I did it like this:
../configure --with-apxs2=/usr/sbin/apxs --with-mysql

All I'm trying to achieve is to get a response from the neteller test
server, the response will be an error as the numbers I'm sending it are
garbage, but I'm not bothered about that, I just want to be able to
send the request and get the response back. I've searched google for a
while but can't figure out why my code isn't working, I know there were
problems with windows platforms with php4 but obviously, that is not an
issue here...


Thanks in advance, my code is below...

View Replies !
Posting With Fsockopen ?
I am trying post article using fsockopen. Even though i can connect to the server, i am keep getting this error message when ever i try to post something.

Warning: Supplied argument is not a valid File-Handle resource in
/user/php/send.php on line 19

View Replies !
Odd Fsockopen Behavior
Any IP address I try to open with fsockopen on a particular server
seems to use another IP address instead.

eg. I open a socket connection to 192.168.1.1 but the remote_addr that
the other server sees is 192.168.1.255. It's as if, like I said, the
IP address I supply to fsockopen is being replaced with another one.

Anyway, this is breaking a script of mine. I don't think I can really
do a lot in PHP to fix this but is there perhaps some way that I can
detect it? Is there some command line parameter that I can pass to
passthru or something that'll tell me whether or not such a thing is
happening?

Also, how is this even being done? Could a firewall do this? If so,
I'm still not even sure how it'd be done...

View Replies !
Local Fsockopen()
I am tring to develop a site that conects via sockets. I am doing the development on a localhost Apache server here's a small code example:-

<?php
$host="127.0.0.1";
$socket=fsockopen($host,80,$errno,$errstr,50);
if(!$socket){echo "NO CONNECTION".$errno.$strerror;}
else
{ fputs ($socket, "GET/apache/htdocs/phpinfo.php HTTP/1.1");
$info=''
while (!feof($socket)) {
$info.=fgets($socket,1024);}
fclose ($socket);
echo $info;

I'm having a problem with the fputs() line. After the GET/ sataement I am trying to direct he socket to a file, so I will be able to read/write but the fputs() doesn't seem to accept any path I put into it. The socket works ok because If I leave out the path I am sent o the apache intro page on my localhost.

View Replies !
Request Fsockopen
I'm having a problem with fsockopen function, I'm programming with php
4.3 and need to do an HTTP POST over secure socket, ssl, here's my
code:

$context = stream_context_create();
$result = stream_context_set_option($context, 'ssl', 'local_cert',
"/certificate/cert.pem");
$result = stream_context_set_option($context, 'ssl', 'passphrase',
"passphrase");

$sock = fsockopen("ssl://myhost", 443 , $errno, $errstr, 30, $context);
if (!$sock) die("$errstr ($errno)
");

I get this error when trying to run this code:
Warning: fsockopen(): Unable to set local cert chain file
`/certificate/cert.pem' Check that your cafile/capath settings include
details of your certificate and its issuer in /path/to/file.php on line
xxx

Dunno what to do, I thought there's something wrong in my certificate
but couldn't find any real explanation on google or php site,

View Replies !
GET Request W/fsockopen()
The following function retreives a GET request. It works great with many
sites (exp. www.msn.com), but others just hang (exp. www.ebay.com) or return
an error (exp. www.microsoft.com).

I've tried adding additional headers like "Referer" and "Accept", but it
doesn't make a difference.

What needs to be done to satisfy those web servers that won't cooperate?

$link = "http://www.domain.com?param1=string";

$http_response = "";
$url = parse_url($link);
$fp = fsockopen($url[host], 80, $err_num, $err_msg, 30) or die("Socket-open
failed--error: ".$err_num." ".$err_msg);
fputs($fp, "GET /$url[path]?$url[query] HTTP/1.0
");
fputs($fp, "Connection: close

");
while(!feof($fp)) {
$http_response .= fgets($fp, 128);
}
fclose($fp);
echo $http_response;

View Replies !
Using Fsockopen() And Fputs()
I'm using fsockopen() function to establish connection with server. After I have loop which generate passwords inside that loop I have fputs() to make request to the server and ‘echo’ for testing of my password combination. Since I can see all password combination my loop is working OK, but fputs() it make only one request. Code:

View Replies !
Fsockopen Errors
In the code fragment below $errno and $errstr get set to the
system-level errno and strerror() from the connect() call. Does anyone
know what the errors below mean an how I may rectify them?

$fp = fsockopen($host, $port, $errno, $errstr, 30);

Here are the resulting errors I get regardless of what I specify for
$host:

$errno = "115"
$errstr = "Operation now in progress"

View Replies !
Fsockopen Error Need Some Help Thanks
I am using php version 4.3.9 and lets say i have a file on the server
called tester.php

so i am using fsockopen to point to that file but it gives me a error below.

$fh = @fsockopen("http://www.mysite.com/teter.php", "80", $errno, $errstr,
180);

111 Connection refused

This server is linux Redhat Enterprise with Apache 2.x

Is there anything i need to edit in the php.ini file or apache file.

View Replies !
Fsockopen And Redirect?
I'm attempting to write a script that pulls a list of URLs from my database, checks to see what the last modified date of that URL is, and updates the database with each URL's new last modified timestamp. It's working in most cases right now, but it seems fsockopen can't handle redirects very well according to some google searches.

This is especially problematic because most of the URLs I'm checking are RSS feeds and a lot of them redirect to feedburner now for analytics. Code:

View Replies !
Fsockopen() And Telnet
I'm considering using a PHP command line script to retrieve reports from a
Linux system. My only source for the report is via telnet.

Has anybody here used fsockopen() to interactively script a telnet session
in PHP?

If so, what problems did you have to overcome. If not, does this sound
do-able?




View Replies !
Fsockopen Slow
I'm having an issue with speed at the moment. Basically I have a database with a list of websites on it. I only want to display the sites that are actually 'live'. I've used fsockopen and it does work. Only problem is it takes quite a while.

I seem to be waiting at least 10 seconds for it to tell me the site is not responding. It is very quick when the site does exist though. I've played with the optional timeout from fsockopen but I see no difference. Any suggestions? Is there another faster way to check a site is online using php?

View Replies !
POST And Fsockopen()
What I have done is change from one autoresponder company to another I have exported my email lists from previuos company.Now what happens is if I POST via a WEB FORM that email goes into the lead list and no verification s sent to my lead.

If I add by fsockopen() the lead is added to my lead list but a confirmation email is sent to my lead. This I want to prevent cause I have changed before and I donot want to get a impression with my leads. Code:

View Replies !
Fopen / Fsockopen
I want to write a simple PHP code to verify whether a given list of URLs is broken or not. The URLs given have various formats, for example .....

View Replies !
Curl Vs Fsockopen
I' m developping a web page html parser. For now I get the page using fsockopen. A friend of mine advised me to use curl, but I don' t really understand why it would be better using curl.

That' s why I ask the question :

what are the differences between fsockopen and curl?

View Replies !
Different Between Ftp_connect() And Fsockopen()
I want to know what the different between ftp_connect() and fsockopen() if I use these functions to transfer file (FTP). I already tried both to transfer files. Which one is better to used and why?

View Replies !
Fsockopen Timing Out
$who_is = fsockopen($server, 43, $errn,$errstr) or die ("$errn - $errstr");

It simply keeps timing out,  I don't know what the issue is, I can connect with telnet just fine. Anyone?   

View Replies !
Fsockopen - Bind To IP?
Is there a way to tell fsockopen() to bind to a certain IP?

View Replies !
Bind IP With Fsockopen
is it possible to socket_bind with fsockopen? im using this...

$fs = fsockopen('example.com', 2043, $errno, $errstr, 60);
if (!$fs) {
   fclose($fs);

and I need the remote conection to see me as one of my other IP's but cant see how to use it with my above code.

View Replies !
Fsockopen() & Mail()
Currently on a shared server, I contact support now and again. But have discovered that the person on the other end lacks technical expertise, to put it lightly. Until I can get a change of servers, how can I check (phpmyadmin?) if my server supports fsockopen() function and & mail() function?

View Replies !
Fsockopen Error
when using phpmailer I get the following error

Warning: fsockopen() [function.fsockopen]: unable to connect to 63.246.152.30:25 (No route to host) in /var/www/vhosts/shoppingcenter-advisor.com/httpdocs/includes/mailer/class.smtp.php on line 105
Message was not sent.Mailer error: Language string failed to load: connect_host

I've been trying to google the error but all I find are pages that are suffering the same error lol - can someone point me in the right direction?

View Replies !
Using Fsockopen/fread
I have a page that sends a post request to another page, which generates some data and echos it back to the first page. It works perfectly on my own machine (windows), but when I put it on the live machine (unix), the request page seems to be having superfluous lines being returned.

From my logging records, I know that the data is fine before it is sent back, but after it is received by the request page, there is a line with the number 2000 on it after every 242 lines of the data, each line being 32 bytes long. However the last one of these lines is almost always letters. I'm assuming this is a data length in hex, but it doesn't seem to tie up with the calculated length based on 32 (length of each line) * 242.

View Replies !
Fsockopen Available In This Config
I am about to set up a new site where I need to synidcate outside rss feeds on my website. I plan to use a php script which uses fsockopen() function [according to rss fetching software called magpieRSS]. I was about to sign up for the hosting when I discovered on the web that many hosts do not allow "outside" socket connections made from their hosting. In order to be sure, I contacted my webhost and asked if they supported fsockopen, to which they sent information (txt attachment) regarding the PHP commands supported on their service, but I can't find fsockopen anywhere.

View Replies !
Fsockopen() Error
Script: PHP Code:

<?php
$test = fsockopen ('http://www.chrome.pl', &#55620;&#57088;');
?>

Result: Code:

Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.chrome.pl:8080 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on line 2
Environment: Apache2, PHP5, Ubuntu5

View Replies !
Fsockopen Hanging
I've been building a spider in php for the last few weeks and I’m having continuous problems with downloading pages from the internet. I thought I built a robust program but I just keeps hanging during downloads. Code:

View Replies !
PayPal + Fsockopen
I'm trying to develop an application with paypal and fsockopen may be a solution with curl instead ?

I have a page with a form on the site where users enter the id number, mark checkboxes beside the agreement and enter an email address as their username.

After user submits the form it posts back to the script on my server to parse the information entered in the form and if everything is ok script takes him/her directly to the PayPal screen (using fsockopen). Code:

View Replies !
Redirect From Http To Https And Then Back To Https To Http
I need help with redirect from http to https when I user click on register.php and abter he completes the form I want to redirect back to http.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved