[PHP] Re: cURL issues posting to an end point

2012-10-11 Thread Ian
On 04/10/2012 15:54, Bastien Koert wrote:
 Hi All,
 
 I have a page that receives third party data into my app, xml data via
 https post. This works fine and I receive the data as expected. The
 issue I am facing is around posting XML data back as a synchronous
 response to the post I receive. I am using the following code:
 

snip

 
   $result = curl_exec($ch);
   
   curl_close($ch);
   // Print CURL result.
   echo $ch_result;
 }
 
 
 The endpoint recipient says they are not receiving the data and I am
 at a loss to figure out why. Any insight would be appreciated.
 
 Thanks,
 
Hi,

Try adding some error checking before and after the curl_exec() call:

// Check for an error
if(curl_errno($ch)0){
print Error creating curl object: Err Number:.
curl_errno($ch).  ,Description: . curl_error($ch);
}

// Execute request
$result = curl_exec($ch);

// Check for an error again
if(curl_errno($ch)0){
print Error executing query: Err Number:. curl_errno($ch).
, Description: . curl_error($ch));
}

It may also be wise to increase your time out whilst testing, just in case.


Regards

Ian
-- 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: CURL vs Exif_imagetype()

2012-09-20 Thread Maciek Sokolewicz

On 20-09-2012 13:48, Rango wrote:

Hi,

I host a flash painting tool on my site, and wanted to add ability for the
users to add a background image from a given url, but I have to make sure
the url they add truely refers to a real jpg file, and not something else.

I found a methoed with exif_imagetype() that worked except my webhost has
disabled the allow_url_fopen due to security issues, instead they
recommented me to use CURL and said that the exif_imagetype() is not a
modern way to use php today. (what do I know)?

Question: Is it possible for me to use CURL to verify the authenticity of a
jpg file?

...and if so, how? Regards from Rango`




Hi Rango,

without actually having the actual imagefile at your disposal, it is 
impossible to determine if it's a valid imagefile or not. Curl is just a 
set of function which help you in downloading that imagefile, it does 
not in any way help you to figure out if an image is valid or not.


Your host probably told you that instead of giving an URL as the 
argument to exif_imagetype() you should use curl to download the image, 
and then pass a LOCAL path to exif_imagetype() instead. You simply 
misinterpreted what they tried to tell you.


The reason for this is that the curl library is specifically created to 
handle internet connections (and download, upload, post, etc.). Whereas 
when allow_url_fopen is set to true, then all possible PHP functions can 
suddenly try to download anything they want. This leads to a massive 
increase in the chance of getting malicious scripts to run on your 
webserver. Now, instead of opening all possible php functions to this 
problem, they only allow curl to 'open urls', and as such limit the 
potential problems.


So:
1. use curl to download the file (but first make sure it's not too large)
2. then (still) use exif_imagetype on that downloaded (and locally 
stored!) file

3. remove the file from your system

Note however, that exif_imagetype is not perfect, and will at times 
reject valid images. Though it doesn't happen very often.


- Tul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Curl cost

2011-09-28 Thread Jonesy
On Wed, 28 Sep 2011 01:28:19 -0700, muad shibani wrote:

 what are the costs of using PHP Curl to show another websites on my 
 site as stumbleon do ..  traffic, memory or what?

One cost might be legal expenses and penalties for copyright 
infringement.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Curl fiel Upload

2009-01-21 Thread Matthias Laug
thanks!

2009/1/21 Manuel Lemos mle...@acm.org

 Hello,

 on 01/20/2009 09:10 PM Matthias Laug said the following:
  I've got a problem using curl to upload a file. I want to send it to a
 form
  written with the Django Framework.
 
  Post Request are processed correctly, with one anomaly.
  This piece of code works fine
 
  curl_setopt($process, CURLOPT_POSTFIELDS, http_build_query($data));
 
  But if i provide only an array no data is send to the form
 
  curl_setopt($process, CURLOPT_POSTFIELDS, $data);
 
  I have read somewhere that curl sends formdata with
 enctype=form/mulitpart
  only if I provide an array not a string.
 
  If I add @filename to the $data variable (string or array) it does not
  send the file to the form.
 
  Each example I have found in the internet so far did not work.

 I do not use the Curl functions directly. When possible I use fsockopen
 as alternative and use this HTTP client class to submit any kind of HTTP
 requests. Take a look at the test_http_post.php to see how simple is to
 submit form with one or more file uploads.

 http://www.phpclasses.org/httpclient



 --

 Regards,
 Manuel Lemos

 Find and post PHP jobs
 http://www.phpclasses.org/jobs/

 PHP Classes - Free ready to use OOP components written in PHP
 http://www.phpclasses.org/




-- 
Matthias Laug
Schillerstr. 36
10627 Berlin
http://www.mconcepts-online.com/


[PHP] Re: curl can't connect to my home server

2009-01-20 Thread Rene Veerman
OOPS :)

As a second test, i changed the test-url to

http://82.170.249.144:81/mediaBeez/sn.phphttp://82.170.249.144/mediaBeez/sn.php

On Tue, Jan 20, 2009 at 7:33 PM, Rene Veerman rene7...@gmail.com wrote:

 Hi,

 I've been stuck on this problem i'm having after i re-installed my linux
 (debian) machine last month..

 I'm building a CMS with video import capabilities, but since it runs on
 shared hosting i need to make a cURL POST call to a URL on my home machine,
 which does video-conversion.

 This curl call has stopped working, curl_error() claiming couldn't connect
 to host.

 As a test, i'm simply calling up a url on my homeserver through curl.. The
 url is http://82.170.249.144/mediaBeez/sn.php
 The curl script is at http://veerman.ws/servagetest.php

 Any light you can shed on this is very greatly appreciated.
 I'm kinda stuck at a huge brick wall here..



[PHP] Re: curl can't connect to my home server

2009-01-20 Thread Rene Veerman
And FYI; the test-script i'm using is

?php
 session_write_close();
$ch = curl_init();
#set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, http://82.170.249.144/mediaBeez/sn.php;);
//curl_setopt($ch, CURLOPT_URL, http://www.google.de/;);
//curl_setopt($ch, CURLOPT_HEADER, );
curl_setopt($ch, CURLOPT_PORT, 81);
#grab URL and pass it to the browser
curl_exec($ch);
$error = curl_error($ch);

#close cURL resource, and free up system resources
curl_close($ch);
echo $error;
//phpinfo();
?

On Tue, Jan 20, 2009 at 7:35 PM, Rene Veerman rene7...@gmail.com wrote:

 OOPS :)

 As a second test, i changed the test-url to

 http://82.170.249.144:81/mediaBeez/sn.phphttp://82.170.249.144/mediaBeez/sn.php


 On Tue, Jan 20, 2009 at 7:33 PM, Rene Veerman rene7...@gmail.com wrote:

 Hi,

 I've been stuck on this problem i'm having after i re-installed my linux
 (debian) machine last month..

 I'm building a CMS with video import capabilities, but since it runs on
 shared hosting i need to make a cURL POST call to a URL on my home machine,
 which does video-conversion.

 This curl call has stopped working, curl_error() claiming couldn't
 connect to host.

 As a test, i'm simply calling up a url on my homeserver through curl.. The
 url is http://82.170.249.144/mediaBeez/sn.php
 The curl script is at http://veerman.ws/servagetest.php

 Any light you can shed on this is very greatly appreciated.
 I'm kinda stuck at a huge brick wall here..





Re: [PHP] Re: curl can't connect to my home server

2009-01-20 Thread Eric Butera
On Tue, Jan 20, 2009 at 1:35 PM, Rene Veerman rene7...@gmail.com wrote:
 OOPS :)

 As a second test, i changed the test-url to

 http://82.170.249.144:81/mediaBeez/sn.phphttp://82.170.249.144/mediaBeez/sn.php

 On Tue, Jan 20, 2009 at 7:33 PM, Rene Veerman rene7...@gmail.com wrote:

 Hi,

 I've been stuck on this problem i'm having after i re-installed my linux
 (debian) machine last month..

 I'm building a CMS with video import capabilities, but since it runs on
 shared hosting i need to make a cURL POST call to a URL on my home machine,
 which does video-conversion.

 This curl call has stopped working, curl_error() claiming couldn't connect
 to host.

 As a test, i'm simply calling up a url on my homeserver through curl.. The
 url is http://82.170.249.144/mediaBeez/sn.php
 The curl script is at http://veerman.ws/servagetest.php

 Any light you can shed on this is very greatly appreciated.
 I'm kinda stuck at a huge brick wall here..



$ curl -I http://82.170.249.144:81/mediaBeez/sn.php
HTTP/1.1 200 OK
Date: Tue, 20 Jan 2009 19:40:01 GMT
Server: Apache
X-Powered-By: PHP/5.2.0-8+etch13
Set-Cookie: PHPSESSID=b797765b2b77ffe1d51099e11ca680d8; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/html; charset=UTF-8

Looks like that works.  But it's setting a session.  Unless you're
using cookie jars maybe that could be part of your problem.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Curl fiel Upload

2009-01-20 Thread Manuel Lemos
Hello,

on 01/20/2009 09:10 PM Matthias Laug said the following:
 I've got a problem using curl to upload a file. I want to send it to a form
 written with the Django Framework.
 
 Post Request are processed correctly, with one anomaly.
 This piece of code works fine
 
 curl_setopt($process, CURLOPT_POSTFIELDS, http_build_query($data));
 
 But if i provide only an array no data is send to the form
 
 curl_setopt($process, CURLOPT_POSTFIELDS, $data);
 
 I have read somewhere that curl sends formdata with enctype=form/mulitpart
 only if I provide an array not a string.
 
 If I add @filename to the $data variable (string or array) it does not
 send the file to the form.
 
 Each example I have found in the internet so far did not work.

I do not use the Curl functions directly. When possible I use fsockopen
as alternative and use this HTTP client class to submit any kind of HTTP
requests. Take a look at the test_http_post.php to see how simple is to
submit form with one or more file uploads.

http://www.phpclasses.org/httpclient



-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: CURL receiving content data

2007-08-24 Thread Brian Rue
Bruce, I tried using curl to just get the feed and it worked ok:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 
  'http://api.beta.blogs.aol.com/bsteinback0224/service.xml');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
print curl_exec($ch);

My guess would be that one or more of the extra headers you're sending are
causing the server to get confused... i.e. maybe you're missing a slash in
the referer, or you're otherwise not sending the exact headers the server is
expecting. The Live HTTP Headers firefox extension has been really helpful
for me; give it a try if you haven't already.

Good luck...

-Brian Rue

Bruce Steinback wrote:

 Hi all,
 
 First thanks to the people that corrected my dumb mistake on XML parsing a
 few weeks ago, and let's hope that this is as dumb.
 
 I've got a mashup that when contacted attempts to gather feed info to mash
 into it's response.  I send a GET request (Atom request to be exact), and
 get the following back:
 
 HTTP/1.0 200 OK Date: Thu 23 Aug 2007 21:27:48 GMT Server: Apache/2.0.54
 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7e mod_jk/1.2.14 Content-Length: 222
 Connection: close Content-Type: application/atomsvc+xml;charset=UTF-8
 
 but no Content data (the Atom XML response in the Content-Type).
 
 Here's my code:
 $checkBlogsUrl = http://api.beta.blogs.aol.com/; . $owner .
 /service.xml; $sessionRequest = curl_init();
 curl_setopt( $sessionRequest, CURLOPT_URL, $checkBlogsUrl);
 curl_setopt( $sessionRequest, CURLOPT_RETURNTRANSFER, true );
 curl_setopt( $sessionRequest, CURLOPT_REFERER, $baseUrl .
 loginresp-blogs.php); $header[] = X-AOL-DEVID:  . $devId;
 $header[] = Authorization=OpenAuth token:  . $token;
 curl_setopt( $sessionRequest, CURLOPT_HTTPHEADER, $header);
 curl_setopt( $sessionRequest, CURLOPT_HEADER, 1);
 $responseBase = curl_exec( $sessionRequest );
 //$responseXml = curl_multi_getcontent($sessionRequest);
 print br/ . $responseBase;
 
 As you can see, I tried curl_multi_content hoping it might be for like
 multiple content, but in reviewing the spec, it's obviously for
 aggregating multiple requests.
 
 There's definitely content there, you can try:
 http://api.beta.blogs.aol.com/bsteinback0224/service.xml
 to see it.  And the Content-Length figure looks about right (it was 847
 for bsteinback0224, which was pretty close to the file size when I saved
 it).
 
 I can find dozens of examples of adding POST Content, but none for reading
 file content.  Please don't tell me it can't be done :-(
 
 Thanks,
 Bruce
 
 
 
 



 Pinpoint customers who are looking for what you sell.
 http://searchmarketing.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cURL: multipart/form-data POST request with empty file part

2007-05-05 Thread Manuel Lemos
Hello,

on 05/04/2007 09:44 AM Emmanuel Raulo-Kumagai said the following:
 Hello
 
 I'm writting a client in PHP for some CMS.
 I need to send an HTTP POST request with a multipart/form-data content.
 One of the parts is a file which must look like the request was issued
 after submitting a web form with a input type=file ... field left
 empty, which is *NOT* the same as sending an empty file.
 This means the part should look like this in the request:
 
 -8179530329826\r\n
 Content-Disposition: form-data; name=file; filename=\r\n
 Content-Type: application/octet-stream\r\n
 \r\n
 \r\n
 -8179530329826\r\n
 
 Is there a way to do so with cURL ?

I use this HTTP client class that implicitly composes HTTP requests like
that when it is used to upload files emulating Web forms.

http://www.phpclasses.org/httpclient


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: CURL questions

2007-03-29 Thread Manuel Lemos
Hello,

on 03/29/2007 01:15 PM Angelo Zanetti said the following:
 I have a script on a server that does some processing, now I want to
 execute that script using cURL. This is a basic scenario and I assume
 its possible but its not working.
 
 The script is as follows:
 
$url = http://www/test.php;;
  $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a
 variable
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
$data = curl_exec($ch);
curl_close($ch); echo DATA:  . $data;
 
 Now the $url I have taken out the path for obvious reasons.
 
 I get a 500 Internal server error, not sure why as this page being
 called just inserts a word into a database. Could the cause be something
 else network related? What else can I troubleshoot? or is my code
 incorrect?

It is hard to tell because curl does not output any debugging information.

You may want to try this other HTTP client class that can provide debug
output, so you can see what exactly going on:

http://www.phpclasses.org/httpclient


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: CURL questions

2007-03-29 Thread Chris

Manuel Lemos wrote:

Hello,

on 03/29/2007 01:15 PM Angelo Zanetti said the following:

I have a script on a server that does some processing, now I want to
execute that script using cURL. This is a basic scenario and I assume
its possible but its not working.

The script is as follows:

   $url = http://www/test.php;;
 $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a
variable
   curl_setopt($ch, CURLOPT_TIMEOUT, 100);
   $data = curl_exec($ch);
   curl_close($ch); echo DATA:  . $data;

Now the $url I have taken out the path for obvious reasons.

I get a 500 Internal server error, not sure why as this page being
called just inserts a word into a database. Could the cause be something
else network related? What else can I troubleshoot? or is my code
incorrect?


It is hard to tell because curl does not output any debugging information.


Actually it does.

http://www.php.net/manual/en/function.curl-setopt.php

See CURLOPT_VERBOSE

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: CURL questions

2007-03-29 Thread Manuel Lemos
Hello,

on 03/30/2007 12:38 AM Chris said the following:
 I get a 500 Internal server error, not sure why as this page being
 called just inserts a word into a database. Could the cause be something
 else network related? What else can I troubleshoot? or is my code
 incorrect?

 It is hard to tell because curl does not output any debugging
 information.
 
 Actually it does.
 
 http://www.php.net/manual/en/function.curl-setopt.php
 
 See CURLOPT_VERBOSE

Interesting. I was not aware of that option. It seems to send some
output to stderr. stderr usually goes to Web server error log. But how
can we capture that output from a PHP script and display it?


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: CURL questions

2007-03-29 Thread Chris

Manuel Lemos wrote:

Hello,

on 03/30/2007 12:38 AM Chris said the following:

I get a 500 Internal server error, not sure why as this page being
called just inserts a word into a database. Could the cause be something
else network related? What else can I troubleshoot? or is my code
incorrect?

It is hard to tell because curl does not output any debugging
information.

Actually it does.

http://www.php.net/manual/en/function.curl-setopt.php

See CURLOPT_VERBOSE


Interesting. I was not aware of that option. It seems to send some
output to stderr. stderr usually goes to Web server error log. But how
can we capture that output from a PHP script and display it?


Set CURLOPT_RETURNTRANSFER and it should return *untested*.

Also http://php.net/curl_error can get the error :)

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cURL and sending an POST with an @ as first char.

2006-08-24 Thread Mathijs

Mathijs wrote:

Hello there,

I Have a question about cURL and sending POST data.

I have an array with values which are needed for an POST.
There is one value which starts with an @.
This gives me a error: ErrorNo.: 26, ErrorMsg: 'failed creating formpost 
data'.


This is becouse an @ at the start of a value is treated as an File 
upload or something.


I realy need this to be an @ at the start, and i can't add an space 
infront of it.


How can i fix this.
Tryed searching cURL's website didn't found anything (yet).

Thx in advance.


It seems that i have found a fix.
I Now check if it starts with an @ and the replaces it with \@.
Then it will send normaly :).

If anyone has an other sulution, please tell me.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cURL and sending an POST with an @ as first char.

2006-08-24 Thread Jo�o C�ndido de Souza Neto
I think urlencode can solve this.

Mathijs [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Hello there,

 I Have a question about cURL and sending POST data.

 I have an array with values which are needed for an POST.
 There is one value which starts with an @.
 This gives me a error: ErrorNo.: 26, ErrorMsg: 'failed creating formpost 
 data'.

 This is becouse an @ at the start of a value is treated as an File upload 
 or something.

 I realy need this to be an @ at the start, and i can't add an space 
 infront of it.

 How can i fix this.
 Tryed searching cURL's website didn't found anything (yet).

 Thx in advance. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cURL and sending an POST with an @ as first char.

2006-08-24 Thread M. Sokolewicz

Mathijs wrote:

Mathijs wrote:


Hello there,

I Have a question about cURL and sending POST data.

I have an array with values which are needed for an POST.
There is one value which starts with an @.
This gives me a error: ErrorNo.: 26, ErrorMsg: 'failed creating 
formpost data'.


This is becouse an @ at the start of a value is treated as an File 
upload or something.


I realy need this to be an @ at the start, and i can't add an space 
infront of it.


How can i fix this.
Tryed searching cURL's website didn't found anything (yet).

Thx in advance.



It seems that i have found a fix.
I Now check if it starts with an @ and the replaces it with \@.
Then it will send normaly :).

If anyone has an other sulution, please tell me.


it's called escaping meta-characters, @ has a special meaning, \@ (the 
escaped version of @) is the literal @ character. the same way as ' in 
many languages is also a special character, \' is its counterpart, the 
literal quote.
So, no, there shouldn't be another solution since your solution is the 
correct one.


- tul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Curl Question

2006-01-03 Thread Manuel Lemos

Hello,

on 01/03/2006 06:52 PM Ray Hauge said the following:
I just wanted to see if anyone knew if there was any difference in 
performance between using curl in an exec() statement and when using the 
libCurl functions within PHP.


Executing a separate program should be a little slower as it adds some 
overhead before executing a request. Actually, in some cases it can be a 
little faster to use fsockopen instead of libcurl as it is one less 
library to load.


You may also want to take a look at this HTTP client class that uses 
fsockopen everytime it is possible and only uses libcurl functions in 
certain cases. This class takes care of cookie handling, redirection, 
form posting, file uploading, etc..


http://www.phpclasses.org/httpclient


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Curl Question

2006-01-03 Thread Ray Hauge

Thanks for the info!

Manuel Lemos wrote:


Hello,

on 01/03/2006 06:52 PM Ray Hauge said the following:

I just wanted to see if anyone knew if there was any difference in 
performance between using curl in an exec() statement and when using 
the libCurl functions within PHP.



Executing a separate program should be a little slower as it adds some 
overhead before executing a request. Actually, in some cases it can be 
a little faster to use fsockopen instead of libcurl as it is one less 
library to load.


You may also want to take a look at this HTTP client class that uses 
fsockopen everytime it is possible and only uses libcurl functions in 
certain cases. This class takes care of cookie handling, redirection, 
form posting, file uploading, etc..


http://www.phpclasses.org/httpclient




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cURL to re-post form iinformation

2005-10-25 Thread Al

Jay Blanchard wrote:

Howdy all,

I am trying a new technique, for me, when processing a form. The form is
filled out and submitted, during processing it is determined that there is
an error with the posted data...such as a blank or mismatched password,
I want to return the form with the data filled out using curlas a test I
did this

/* curl post test */

   $post_data['username'] = $_POST['username'];
   $post_data['password'] = $_POST['password'];
   $url = http://TEST20051010/FMSRegister.php;;

   /* assemble POST data in string */
$pd=;
foreach ($post_data as $k=$v){
$pd.= $k=.$v.;
}
  $post_data=substr($pd,0,-1);

$ch = curl_init();
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);

curl_close($ch);

Now, this works OK...save for one little problem that I cannot seem to
figure out. The URL now reads

   http://TEST20051010/NameOfProcessingScript.php instead of
FMSRegister.php. 


I am searching the curl options http://www.php.net/curl_setopt but have not
found what I am looking for. Can someone clue me in?
Thanks!



Here is how I do what it sounds like you want to do.

Simply serialize your POST array, i.e., $saved_post= serialize($_post)and save it [a file or session buffer, whatever] 
if you are instigating a new page; if not, you have the post array saved.


Then when you want to repopulate the form, simply unserialize($saved_post) and fill in your inputs.. etc. from the 
array.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: cURL to re-post form iinformation - SOLVED SORTA

2005-10-25 Thread Jay Blanchard
[snip]
 Now, this works OK...save for one little problem that I cannot seem to
 figure out. The URL now reads
 
http://TEST20051010/NameOfProcessingScript.php instead of
 FMSRegister.php. 
[/snip]

I kinda' solved this, but not reallyit was more of a mental adjustment. 

FMSRegister.php  registration form
FMSProc.php  central processing script

If the registration form is incomplete I use cURL to post the data and form
to the user even if the name of the file is not the same. I could call the
central processing script (which acts on application items in a switch
statement) something clever since it is being presented back to the user,
but since this is for an internal application I probably will not bother. It
would be neat if cURL could essentially post an interface back to the
browserbut I do understand the complications. A search has yielded
several who have basically asked the same question as I have though.

Now, I know that this may have some to do with laziness on my part, but it
was mostly an experiment. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: curl version and PHP docs

2005-09-19 Thread Mark Rees
To put the question more simply, is there any way of finding out what
versions of the PHP modules ship with each/the latest release, short of
installing that version of PHP? Some release notes, for example?

Thanks in advance

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cUrl and proxies

2005-07-01 Thread Manuel Lemos

Hello,

on 06/30/2005 01:27 PM Mark Rees said the following:

UPDATE: I think it is a bug in cURL, according to this link (I am using an
ISA proxy).

https://sourceforge.net/tracker/?func=detailatid=100976aid=1188280group_i
d=976


In that case you may want to try this PHP HTTP client class that 
supports access via proxies, proxy authentication and SSL as you need.


http://www.phpclasses.org/httpclient


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: cUrl and proxies

2005-06-30 Thread Mark Rees
UPDATE: I think it is a bug in cURL, according to this link (I am using an
ISA proxy).

https://sourceforge.net/tracker/?func=detailatid=100976aid=1188280group_i
d=976

So all I need to do is install the latest version of cURL then. I am really
struggling with this - I don't have a good understanding of how PHP and cURL
interact. I already have the necessary dlls on my machine :

php_curl.dll
libeay.dll
ssleay.dll

But what can I download from

http://curl.haxx.se/download.html

I don't see any of those files there, and the windows package includes only
curl.exe - where does that fit in?

The readme files in the package I did download don't really help either:
http://curl.haxx.se/dlwiz/?type=*os=Win32flav=-ver=2000%2FXP

Please help if you can

Mark

Mark Rees [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello

 This code gives me a 407  Proxy Authentication Required message. Can
anyone
 see what is missing? The username and password are definitely correct, as
 are the proxy IP and port.

 Win2k. php 5.0.4

 $ch=curl_init();
 curl_setopt ($ch, CURLOPT_URL, 'http://www.google.com/');
 curl_setopt($ch, CURLOPT_HEADER, 1);
 curl_setopt($ch,CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1');
 curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
 curl_setopt($ch,CURLOPT_PROXY,'10.0.0.8:8080');
 curl_setopt($ch,CURLOPT_PROXYUSERPWD,'abc:123');
 $ret = curl_exec($ch);

 Thanks in advance

 Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: cUrl and proxies

2005-06-30 Thread Richard Lynch
On Thu, June 30, 2005 9:27 am, Mark Rees said:
 UPDATE: I think it is a bug in cURL, according to this link (I am using an
 ISA proxy).
 https://sourceforge.net/tracker/?func=detailatid=100976aid=1188280group_i
 d=976

 So all I need to do is install the latest version of cURL then. I am
 really
 struggling with this - I don't have a good understanding of how PHP and
 cURL
 interact. I already have the necessary dlls on my machine :

How PHP and cURL (and Apache) interact:

PHP is a Module of Apache (or Service of IIS, or [shudder] runs as CGI)
php_curl.dll is a Module of PHP

So PHP is a tick on the back of the dog to Apache, and php_curl is a flea
on the tick. :-v

Now, in most cases, like MySQL, you also need MySQL installed on the
machine.  So, possibly, you will need that new curl.exe ALONG WITH a *new*
php_curl.dll

DO NOT ATTEMPT TO MIX-N-MATCH THE DIFFERENT VERSIONS OF DLL AND EXE!!!

While it might work for awhile, that's only sheer coincidence that the
particular functions in curl/php you are using didn't change between those
two versions.  As soon as you try to use a function that *DID* change,
Whammo! the thing will crash and burn.

You'll end up very cranky, possibly with a problem caused by a bad
decision months and months ago, and you won't have any idea of the cause
and effect relationship, cuz it worked fine for so long.

I'm not sure you even need the curl.exe -- I suspect that all the
functionality of curl.exe gets bundled up into php_curl.dll

Now the bad news:
You would need to re-compile php_curl, using your current version of PHP
source, and the version of curl source you want, on a Windows box, to get
the php_curl.dll you need.

That requires A) having a copy of MSVC++ (Microsoft Visual C++)
compiler/IDE and B) knowing how to work MSVC *very* well, to set up your
environment the way it needs to be to compile PHP.

A) is easy to solve if you have money.
B) is not so easy...  There may be a How To for PHP and MSVC out there,
but it sure didn't exist back when I tried this, quite some years ago.  I
failed miserably.

You may want to take your plight to the PHP-Windows mailing list.  There
are probably more people there who are actually capable of running MSVC
and getting PHP to compile.  They might just do it for you.  They may even
have the particular version of php_curl.dll you need available somewhere.

 php_curl.dll
 libeay.dll
 ssleay.dll

 But what can I download from

 http://curl.haxx.se/download.html

 I don't see any of those files there, and the windows package includes
 only
 curl.exe - where does that fit in?

 The readme files in the package I did download don't really help either:
 http://curl.haxx.se/dlwiz/?type=*os=Win32flav=-ver=2000%2FXP

 Please help if you can

 Mark

 Mark Rees [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Hello

 This code gives me a 407  Proxy Authentication Required message. Can
 anyone
 see what is missing? The username and password are definitely correct,
 as
 are the proxy IP and port.

 Win2k. php 5.0.4

 $ch=curl_init();
 curl_setopt ($ch, CURLOPT_URL, 'http://www.google.com/');
 curl_setopt($ch, CURLOPT_HEADER, 1);
 curl_setopt($ch,CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1');
 curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
 curl_setopt($ch,CURLOPT_PROXY,'10.0.0.8:8080');
 curl_setopt($ch,CURLOPT_PROXYUSERPWD,'abc:123');
 $ret = curl_exec($ch);

 Thanks in advance

 Mark

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: CURL running form PHP exec() problem!

2005-04-07 Thread cragland
I've encountered the same problem with exec(curl, system(curl, etc.  PHP
exits with sh: \curl: No file or directory.  I'm wondering if there is
some php shell option that has to be set.

My other problem:

Upfront, I can post and recieve data just fine with asp.net, perl, and
java client scripts.  so I'm kind up against a wall with following curl
issue.  Thanks in advance.

client side cert post with curl.  From command line, I'm able to
connect, ssl authenticate and post.  But server complains with HTTP 405
method not allowed.  Snippet of curl trace below (more below after
snippet):

: 48 54 54 50 2f 31 2e 31 20 31 30 30 20 43 6f 6e HTTP/1.1 100 Con
0010: 74 69 6e 75 65 0d 0atinue..
= Recv header, 27 bytes (0x1b)
: 53 65 72 76 65 72 3a 20 4d 69 63 72 6f 73 6f 66 Server: Microsof
0010: 74 2d 49 49 53 2f 35 2e 30 0d 0at-IIS/5.0..
= Recv header, 37 bytes (0x25)
: 44 61 74 65 3a 20 54 68 75 2c 20 30 37 20 41 70 Date: Thu, 07 Ap
0010: 72 20 32 30 30 35 20 31 38 3a 32 32 3a 33 31 20 r 2005 18:22:31 
0020: 47 4d 54 0d 0a  GMT..
= Recv header, 33 bytes (0x21)
: 48 54 54 50 2f 31 2e 31 20 34 30 35 20 4d 65 74 HTTP/1.1 405 Met
0010: 68 6f 64 20 6e 6f 74 20 61 6c 6c 6f 77 65 64 0d hod not allowed.
0020: 0a  .
= Recv header, 27 bytes (0x1b)
: 53 65 72 76 65 72 3a 20 4d 69 63 72 6f 73 6f 66 Server: Microsof
0010: 74 2d 49 49 53 2f 35 2e 30 0d 0at-IIS/5.0..
= Recv header, 37 bytes (0x25)
: 44 61 74 65 3a 20 54 68 75 2c 20 30 37 20 41 70 Date: Thu, 07 Ap
0010: 72 20 32 30 30 35 20 31 38 3a 32 32 3a 33 31 20 r 2005 18:22:31 
0020: 47 4d 54 0d 0a  GMT..
= Recv header, 19 bytes (0x13)
: 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 Connection: clos
0010: 65 0d 0ae..

Then, a CheckDown service with meta name ROBOTS comes back with HTTP 405
resource not allowed.  That then is followed by a 404 error which from
little I've read involves mapping issues on the server itself.  Any help
would be appreciated.  I have the full curl trace if you want it.
Thanks.

cole ragland
mailto:[EMAIL PROTECTED]



MMS firstam.com made the following
 annotations on 04/07/2005 12:06:33 PM
--
THIS E-MAIL MESSAGE AND ANY FILES TRANSMITTED HEREWITH, ARE INTENDED SOLELY 
FOR THE USE OF THE INDIVIDUAL(S) ADDRESSED AND MAY CONTAIN CONFIDENTIAL, 
PROPRIETARY OR PRIVILEGED INFORMATION.  IF YOU ARE NOT THE ADDRESSEE INDICATED 
IN THIS MESSAGE (OR RESPONSIBLE FOR DELIVERY OF THIS MESSAGE TO SUCH PERSON) 
YOU MAY NOT REVIEW, USE, DISCLOSE OR DISTRIBUTE THIS MESSAGE OR ANY FILES 
TRANSMITTED HEREWITH.  IF YOU RECEIVE THIS MESSAGE IN ERROR, PLEASE CONTACT THE 
SENDER BY REPLY E-MAIL AND DELETE THIS MESSAGE AND ALL COPIES OF IT FROM YOUR 
SYSTEM.
==

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: CURL running form PHP exec() problem!

2005-04-07 Thread Richard Lynch
On Thu, April 7, 2005 11:54 am, cragland said:
 I've encountered the same problem with exec(curl, system(curl, etc.  PHP
 exits with sh: \curl: No file or directory.  I'm wondering if there is
 some php shell option that has to be set.

Use full path names for EVERYTHING in exec.

If curl, as I suspect, needs access to some kind of storage for .SSH keys,
Cookies, etc, then the PHP User needs that access.

Why not just use http://php.net/curl

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: curl CUSTOMREQUEST

2004-12-21 Thread Manuel Lemos
Hello,
on 12/21/2004 05:10 PM Juan Nin said the following:
I saw a post at http://www.php.net/manual/en/ref.curl.php where it says:
Using the customrequest for a complete post is wrong. Libcurl will add
a partial url, the http version and the standard headers after the post
data - while this works with a non-persistent connection and an apache
web server, it may fail under different conditions
Does anybody know a bit more on this?? (I sent an e-mail to the one
who posted it, but the address does not longer exist)
I use custom requests with Curl library using this HTTP client class but 
I only do that to perform SSL requests. For other types of requests the 
class uses connections opened with fsockopen . In any case I do not 
experience the problem that you see.

http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: cURL and Proxy Servers

2004-09-30 Thread Manuel Lemos
Hello,
On 09/30/2004 11:27 AM, Nick Wilson wrote:
I'm using cURL and have a question about this line (part of a function)
curl_setopt($ch, CURLOPT_PROXY, $proxy2use);
I know that *after* I curl_exec() i can find out if the proxy resolved
or not with curl_errno() (it would return 5) but it seems that if it
does fail to resolve, it will default to the users IP
This is not acceptable ;-)
I already check that the proxy is up and i can connect to it prior to
running my curl function, but if the proxy still doesnt resolve, how
might i prevent the curl function form executing?
You may want to try this HTTP client class instead. It supports requests 
via proxies and does not use Curl.

http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: cURL and Proxy Servers

2004-09-30 Thread Nick Wilson

* and then Manuel Lemos declared
 You may want to try this HTTP client class instead. It supports requests 
 via proxies and does not use Curl.
 
 http://www.phpclasses.org/httpclient

Hmmm.. good point Manuel, i have seen the class, in fact it was the
original way i /was/ going to build the script. Wouldnt be hard to rip
out the cURL function and replace it with an http method, thanks...

-- 
Nick W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: curl grabbing a website

2004-09-20 Thread Matthew Weier O'Phinney
* Martin Justra [EMAIL PROTECTED]:
 I finally managed to grab the website via curl. Now the problen is that I 
 want to have a small piece of that site. I tried to cut that site by 
 explode. Now the browser hangs. He says waiting for www.domain.de and 
 does nothing.

 Here is my listing:
 ?php
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, 
 https://www.example?benutzer=aaapasswort=bbbic=tracking;);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $test = curl_exec($ch);
 $teil = explode(!-- rows --, $test);
 echo $teil[0];
 curl_close($ch);

Couple of things:
1) I'd close the curl connection before doing your explode
2) I'd check for an error returned by the curl_exec() -- you may have an
error and not even realize it.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: curl grabbing a website

2004-09-19 Thread Manuel Lemos
Hello,
On 09/19/2004 09:49 AM, Martin Justra wrote:
I finally managed to grab the website via curl. Now the problen is that I 
want to have a small piece of that site. I tried to cut that site by 
explode. Now the browser hangs. He says waiting for www.domain.de and 
does nothing.

Here is my listing:
?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 
https://www.example?benutzer=aaapasswort=bbbic=tracking;);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$test = curl_exec($ch);
$teil = explode(!-- rows --, $test);
echo $teil[0];
curl_close($ch);

What did I do wrong ?
It is hard to tell without seeing the actual page content returned by 
the browser.

You may also want to try this HTTP client class and see if the result is 
the same. If it is, just post the HTML returned by the returned page.

http://www.phpclasses.org/httpclient

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: CURL question, cutting off custom request

2004-08-16 Thread Manuel Lemos
Hello,
On 08/16/2004 12:40 PM, Dominic Schanen wrote:
I'm sending a custom request to a server using CURL, which may contain 
some high-ascii characters. Are there certain characters that would 
cause CURL not to send the complete custom request? Are there some CURL 
options that can help make sure the request is sent in its entirity? 
Here is my code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTP_VERSION, 1.0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec ($ch);
Sometimes it appears to cutoff my request with the existance of a NUL 
character.

Any ideas?
That depends on where you are using non-ASCII characters. If it is in 
the request headers, you need to use q-encoding to encode them as ASCII. 
If it is in the request body, it should not be a problem, although I 
think you should specify the character set in the Content-Type header.

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: CURL Help

2004-04-19 Thread Manuel Lemos
Hello,

On 04/20/2004 02:36 AM, Monty wrote:
Do my CURL statements look correct based on what the gateway needs to
receive?? I have PHP 4.3.2 and Apache 2.0 running on Red Hat ES 3.0.
I suspect that the port should not be in the host header.

Anyway, you may want to try using this HTTP client class that can use 
cURL for SSL connections of just fsockopen if you are using PHP 4.3.0 or 
better:

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: CURL and Cookies

2004-02-09 Thread Manuel Lemos
Hello,

On 02/09/2004 05:29 PM, Richard Miller wrote:
I would appreciate any help you can give me about a problem I am having 
with PHP's CURL functions.

I want to use CURL to download news from Wall Street Journal Online.   
When you visit the WSJ home page, you're forwarded to an authentication 
page to enter your name and password, and then forwarded back to the 
home page.  I want my CURL command to send the authentication cookie so 
when it's forwarded to the authentication page it forwards right back to 
the home page without having to enter the name and password.
When I use CURL I specify the whole request header, so I don't know what 
is wrong with your code.

I only use CURL for HTTPS and fsockopen for normal HTTP requests. I 
encapsulated the whole HTTP client protocol handling including cookie 
support into this PHP HTTP client class, that you may want to check out:

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: curl tutorial

2003-12-29 Thread Manuel Lemos
Hello,

On 12/30/2003 04:39 AM, Binay wrote:
can any body point me the direction where i can find curl tutorials. I was going through the curl concept from php manual but couldn't quench my thirst as this section is not very clear. I also searched in the archive but couldn't find any.

if any of u know the resource point(curl tutorial) plz let me know.
You are right, curl API is a bit messy.

I think that if you ask Google, you may find some curl tutorials.

You may also want to take a look at this HTTP client class that provides 
a simpler interface and uses CURL mostly for accessing SSL pages (https):

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: curl and sent headers

2003-09-08 Thread John Ryan
i found out myself if anyone wants to know...


John Ryan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 is there any way of seeing exactly what headers cURL sent in a transfer,
 with PHP?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: curl and sent headers

2003-09-08 Thread Chris Shiflett
--- John Ryan [EMAIL PROTECTED] wrote:
 is there any way of seeing exactly what headers cURL sent in a
 transfer, with PHP?

--- John Ryan [EMAIL PROTECTED] wrote:
 i found out myself if anyone wants to know...

Yes, please. It is always helpful (and courteous) to mention how you solved
your original problem when interacting with this list. This allows you to
contribute back to the list, and ultimately the PHP community. :-)

Even if the answer someone else gave is sufficient, it is nice to quote that
answer and give a quick that worked for archival purposes. This way when
someone references the archive seeking the answer to the same question, they
can see which answer worked for you (the person they will likely relate to the
most).

And, though it doesn't apply to you in this case, it is nice to thank the
person who helped you solve a particular problem. The only motivation for
pouring a lot of effort into responding to the questions here is to feel like
you're helping a lot of people. John Holmes comes to mind as a frequent
contributor, as do many others (is there a list?).

Thanks for your help.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: curl and sent headers

2003-09-08 Thread John Ryan
yeah, sure.

well, for archival purposes, i couldnt do it with PHP. the verbose option
didnt work with PHP, CURLOPT_VERBOSE. but it did work on the command line.
so i logged in and re-created my curl transfer on the command line with an
added -v, for verbose. and it gave me back the headers it sent to the site,
i saw my problem straight away, and modified the PHP script.

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- John Ryan [EMAIL PROTECTED] wrote:
  is there any way of seeing exactly what headers cURL sent in a
  transfer, with PHP?

 --- John Ryan [EMAIL PROTECTED] wrote:
  i found out myself if anyone wants to know...

 Yes, please. It is always helpful (and courteous) to mention how you
solved
 your original problem when interacting with this list. This allows you to
 contribute back to the list, and ultimately the PHP community. :-)

 Even if the answer someone else gave is sufficient, it is nice to quote
that
 answer and give a quick that worked for archival purposes. This way when
 someone references the archive seeking the answer to the same question,
they
 can see which answer worked for you (the person they will likely relate to
the
 most).

 And, though it doesn't apply to you in this case, it is nice to thank the
 person who helped you solve a particular problem. The only motivation for
 pouring a lot of effort into responding to the questions here is to feel
like
 you're helping a lot of people. John Holmes comes to mind as a frequent
 contributor, as do many others (is there a list?).

 Thanks for your help.

 Chris

 =
 Become a better Web developer with the HTTP Developer's Handbook
 http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: CURL

2003-08-14 Thread John Ryan
i was more asking for the actual curl commands to do so, i suppose this
wasnt the rite ng to ask, but ive nowhere else! the docs on the curl site
are kinda crap

Igor Konforti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 yeah, there is way to do it!
 http://www.php.net/manual/en/function.curl-setopt.php


 On Tue, 5 Aug 2003 01:04:42 +0100, John Ryan [EMAIL PROTECTED] wrote:

  theres this site i want to use to execute a command by visting a url.
  like
  http://www.site.com/stuff.php?id=1234message=hello_world
 
  when i visit this in the browser when im logged into www.site.com, it
  works
  as im logged in with cookies or sessions or whatever. but obviosuly i
  cant
  be loged in from a php script, accessing the site using curl. is there
  anyway i can login, curl take the cookie and then access this url??
 
 
 



 --
 Igor Konforti



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: CURL

2003-08-04 Thread Igor Konforti
yeah, there is way to do it!
http://www.php.net/manual/en/function.curl-setopt.php
On Tue, 5 Aug 2003 01:04:42 +0100, John Ryan [EMAIL PROTECTED] wrote:

theres this site i want to use to execute a command by visting a url. 
like
http://www.site.com/stuff.php?id=1234message=hello_world

when i visit this in the browser when im logged into www.site.com, it 
works
as im logged in with cookies or sessions or whatever. but obviosuly i 
cant
be loged in from a php script, accessing the site using curl. is there
anyway i can login, curl take the cookie and then access this url??





--
Igor Konforti
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: CURL

2003-08-04 Thread Jason Sheets
In most cases you can make Curl submit the login form itself, in which 
case Curl would become logged in.
You can use Curl to get both GET and POST requests, the comments in the 
PHP manual are pretty decent.

Jason

John Ryan wrote:

i was more asking for the actual curl commands to do so, i suppose this
wasnt the rite ng to ask, but ive nowhere else! the docs on the curl site
are kinda crap
Igor Konforti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

yeah, there is way to do it!
http://www.php.net/manual/en/function.curl-setopt.php
On Tue, 5 Aug 2003 01:04:42 +0100, John Ryan [EMAIL PROTECTED] wrote:

   

theres this site i want to use to execute a command by visting a url.
like
http://www.site.com/stuff.php?id=1234message=hello_world
when i visit this in the browser when im logged into www.site.com, it
works
as im logged in with cookies or sessions or whatever. but obviosuly i
cant
be loged in from a php script, accessing the site using curl. is there
anyway i can login, curl take the cookie and then access this url??


 

--
Igor Konforti
   



 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Curl NTLM

2003-06-25 Thread Andrew Ziem
Try the PHP file() command.

Assumably you mean HTML not NTML.

Andrew
http://cday.sourceforge.net
Boaz Yahav wrote:
Does anyone have a code snippet that connects to a remote server using
NTML
and gets the HTML source?
Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: Curl NTLM

2003-06-25 Thread Boaz Yahav
I mean NTLM :)

-Original Message-
From: Andrew Ziem [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 26, 2003 5:27 AM
To: Boaz Yahav
Cc: [EMAIL PROTECTED]
Subject: Re: Curl  NTLM


Try the PHP file() command.

Assumably you mean HTML not NTML.


Andrew
http://cday.sourceforge.net

Boaz Yahav wrote:
 Does anyone have a code snippet that connects to a remote server using

 NTML and gets the HTML source?
 
 Sincerely
 
 berber
 
 Visit http://www.weberdev.com/ Today!!!
 To see where PHP might take you tomorrow.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: cURL with PHP Help?

2002-11-20 Thread Steve Keller
At 11/20/2002 08:46 AM, you wrote:

Have you tried this:
http://curl.haxx.se/libcurl/php/examples/

Yeah. That's where you end up from the Sourcefourge site. There's a sample on there 
for a multi-part post, but I'm confused as to how it works.

Would help if you posted some code, or errors or something. I've used curl
in several PHP applications successfully.

I'm not getting any errors. And, as I said, I'm just not getting cURL, so as far as 
code, I've been monkeying with just about every example I  could find. But again, I'm 
not asking for debugging of my code, I'm just trying to find something to help me 
understand how the cURL functions in PHP work. 

Snoopy is actually a really awesome implementation of curl in php:
http://sourceforge.net/projects/snoopy/

I replaced several of my functions with snoopy classes.

Thanks. I'll definitely take a look at that. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: cURL with PHP Help?

2002-11-19 Thread UberGoober
Have you tried this:
http://curl.haxx.se/libcurl/php/examples/

Would help if you posted some code, or errors or something. I've used curl
in several PHP applications successfully.

Snoopy is actually a really awesome implementation of curl in php:
http://sourceforge.net/projects/snoopy/

I replaced several of my functions with snoopy classes.

HTH
--Brian

Steve Keller [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Ok, I'm going to break down and ask for help.

 I'm trying to post an XML file to NetLedger through HTTPs, but cURL isn't
 returning any errors when I run through PHP, and the file isn't getting
there.

 Can someone point me in the direction of a site with some *good* help on
 how to do file posting with cURL under PHP? And when I say good, I mean
 to say that I've already been to PHP.net and the list of CURLOPT's without
 explanation of how to use them is not helpful to someone at my skill
level.
 Neither is the example on Sourceforge.
 --
 S. Keller
 UI Engineer
 The Health TV Channel, Inc.
 (a non - profit organization)
 3820 Lake Otis Pkwy.
 Anchorage, AK 99508
 907.770.6200 ext.220
 907.336.6205 (fax)
 Email: [EMAIL PROTECTED]
 Web: www.healthtvchannel.org




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: cURL and POST

2002-08-21 Thread lallous

even more, if you want to use curl...
I remember that curl can take post data from an input file, so dump the
$strXML to a temp file then supply that file to curl.

good luck,

Samantha Savvakis [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 HI,

 I'm using the cURL binary to perform a HTTP POST to a web page. I am
sending
 XML data to this web page.

 The issue I've come up against if the size of the data that I'm trying to
 post and it looks like cURL is crapping out.

 This is the command line that I'm currently using:

 /usr/local/bin/curl -m 600 -d $strXML http://myurl.com/webpage.php -L -s

 $strXML - variable containing the XML data. I run this command using
exec.

 The return code I receive is: 127. This means a fatal error has occured
with
 cURL but that's all I know.

 I have read the detail about using the -F option. I do not want to POST
the
 file as such, but rather the DATA in the file is I create a file of
the
 XML. The manpage for cURL states:

 -F : To just get  the content part from a file, prefix the file name with
 the letter . The difference between @ and  is then that @ makes a file
get
 attached in the post as a file upload, while the  makes a text field and
 just  get  the contents for that text field from a file.

 So I've tried going:

 /usr/local/bin/curl -m 600 -F /tmp/tempfile.xml
 http://myurl.com/webpage.php -L -s

 /tmp/tempfile.xml - contains the XML data. This isn't working.I'm getting
a
 return code of 2 meaning: Failed to initialize.

 I'm at a loss. I need to post this large amount of XML data to a remote
site
 and don't know how to get it there.

 Any ideas?

 Thanks,
 Sam








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: cURL and POST

2002-08-20 Thread lallous

Try to post it via other than CURL,

http://Sloppycode.net  and search for clsHtmlSource.php

Good luck,
Elias
Samantha Savvakis [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 HI,

 I'm using the cURL binary to perform a HTTP POST to a web page. I am
sending
 XML data to this web page.

 The issue I've come up against if the size of the data that I'm trying to
 post and it looks like cURL is crapping out.

 This is the command line that I'm currently using:

 /usr/local/bin/curl -m 600 -d $strXML http://myurl.com/webpage.php -L -s

 $strXML - variable containing the XML data. I run this command using
exec.

 The return code I receive is: 127. This means a fatal error has occured
with
 cURL but that's all I know.

 I have read the detail about using the -F option. I do not want to POST
the
 file as such, but rather the DATA in the file is I create a file of
the
 XML. The manpage for cURL states:

 -F : To just get  the content part from a file, prefix the file name with
 the letter . The difference between @ and  is then that @ makes a file
get
 attached in the post as a file upload, while the  makes a text field and
 just  get  the contents for that text field from a file.

 So I've tried going:

 /usr/local/bin/curl -m 600 -F /tmp/tempfile.xml
 http://myurl.com/webpage.php -L -s

 /tmp/tempfile.xml - contains the XML data. This isn't working.I'm getting
a
 return code of 2 meaning: Failed to initialize.

 I'm at a loss. I need to post this large amount of XML data to a remote
site
 and don't know how to get it there.

 Any ideas?

 Thanks,
 Sam








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: cURL and POST

2002-08-20 Thread Samantha Savvakis

Thanks for that. I'll look into it.

Sam

Lallous [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Try to post it via other than CURL,

 http://Sloppycode.net  and search for clsHtmlSource.php

 Good luck,
 Elias
 Samantha Savvakis [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  HI,
 
  I'm using the cURL binary to perform a HTTP POST to a web page. I am
 sending
  XML data to this web page.
 
  The issue I've come up against if the size of the data that I'm trying
to
  post and it looks like cURL is crapping out.
 
  This is the command line that I'm currently using:
 
  /usr/local/bin/curl -m 600 -d $strXML
http://myurl.com/webpage.php -L -s
 
  $strXML - variable containing the XML data. I run this command using
 exec.
 
  The return code I receive is: 127. This means a fatal error has occured
 with
  cURL but that's all I know.
 
  I have read the detail about using the -F option. I do not want to POST
 the
  file as such, but rather the DATA in the file is I create a file of
 the
  XML. The manpage for cURL states:
 
  -F : To just get  the content part from a file, prefix the file name
with
  the letter . The difference between @ and  is then that @ makes a file
 get
  attached in the post as a file upload, while the  makes a text field
and
  just  get  the contents for that text field from a file.
 
  So I've tried going:
 
  /usr/local/bin/curl -m 600 -F /tmp/tempfile.xml
  http://myurl.com/webpage.php -L -s
 
  /tmp/tempfile.xml - contains the XML data. This isn't working.I'm
getting
 a
  return code of 2 meaning: Failed to initialize.
 
  I'm at a loss. I need to post this large amount of XML data to a remote
 site
  and don't know how to get it there.
 
  Any ideas?
 
  Thanks,
  Sam
 
 
 
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: CURL and multiple sites at once

2002-03-03 Thread Phillip Oertel

  curl_setopt($ch, CURLOPT_URL, http://foobarcom/page1html;);
  curl_setopt($ch, CURLOPT_FILE, $fh1);
  curl_exec($ch); //exec1
  curl_setopt($ch, CURLOPT_URL, http://foobarcom/page2html;);
  curl_setopt($ch, CURLOPT_FILE, $fh2);
  curl_exec($ch); //exec2
  curl_setopt($ch, CURLOPT_URL, http://foobarcom/page3html;);
  curl_setopt($ch, CURLOPT_FILE, $fh3);

every time you set CURLOPT_URL and CURLOPT_FILE you overwrite the last 
value that's why only the last page will be fetched 

write a function that fetches ONE page and call that in a loop for every 
page you want to fetch

something like this

function fetchAndSavePage($url)
{
// put your fopen  curl code here
// convert the $url into a useful filename

$pagesToFetch = array (page1,page2,page3);

foreach ($pagesToFetch as $url)
{
fetchAndSavePage($url);
}

good luck,
phil


-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP] Re: CURL functions

2001-12-04 Thread Fred

It would be difficult at best to answer your question without first knowing
two things:

1.  What did you expect it to do?
2.  What did it actually do?

Fred

Stefan Isarie [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hey,

 I'm trying to use CURL for sending some headers to paypal. Can anyone tell
 me why this code below doesn't work as expected???

 $ch = curl_init();

 curl_setopt($ch,
 CURLOPT_URL,https://www.paypal.com/cgi-bin/webscr;);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS,
 cmd=_cartupdate=Update$vard=1);

 curl_exec ($ch);
 curl_close ($ch);

 PS: $vard is defined.

 Thanks in advance

 Stefan - Romania



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: cURL support

2001-09-08 Thread Richard Lynch

Compare your ?php phpinfo();? with theirs and see what cURL differences
there are...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Daniel Baldoni [EMAIL PROTECTED]
Newsgroups: php.general
To: PHP users [EMAIL PROTECTED]
Sent: Saturday, September 08, 2001 8:49 AM
Subject: cURL support


 G'day folks,

 I have a site just about ready to go on-line.  All my local testing has
 worked like a dream - but the cURL support on the hosting provider is
 partially broken.

 Actually using curl_init()...curl_exec() etc. on my box to contact remote
 URIs (both over HTTP and HTTPS) has worked from day 1 (with versions
4.0.4p1,
 4.0.5 and 4.0.6).

 On the hosting provider, HTTPS connections don't work.  But, I'm told the
 command-line version of curl does work.

 So, my question is - what gives?  Are there known (intermittent) problems
 with support for cURL or have the provider's staff done something during
 the build of curl and/or PHP?

 Any help would be much appreciated as I really don't like the idea of
palming
 off access to secure sites to yet another external program.  Thanks for
any
 information.

 Ciao.

 --
 ---+--
---
 Daniel Baldoni BAppSc, PGradDipCompSci |  Technical
Director
 require 'std/disclaimer.pl'|  LcdS Pty. Ltd.
 ---+  856B Canning Hwy
 Phone/FAX:  +61-8-9364-8171|  Applecross
 Mobile: 041-888-9794   |  WA 6153
 URL:http://www.lcds.com.au/|  Australia
 ---+--
---
 Any time there's something so ridiculous that no rational systems
programmer
  would even consider trying it, they send for me.; paraphrased from King
Of
  The Murgos by David Eddings.  (I'm not good, just crazy)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]