trophy | 18 Jan 21:21
Picon
Favicon

Help

i get only a erro like this
Connection problem
And why i did notice it was my signature did not updates and i did hear they have change some in root of that site...and how to find out that i have no clue i did pay for that signature creator
and the coder have dissepear and cant get in touch with him
Please hope you can help me
Regards
Anders
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
trophy | 18 Jan 16:39
Picon
Favicon

Help

Hi Please can you have a look at this it did work 2 month ago but now i just get Connection problem.
it get info to my signature i have on my site!
<?php
class IdsManager
{
private $login = "mail adress";
private $pw = "xxxxxxxxxx";
private $authId;
private $playerId;
private $authIdFile;
private $player;
public function __construct($playerName)
{
$this->authIdFile = fopen('ramdisk/authid', 'r');
$this->authId = fgets($this->authIdFile);
$this->retrieveAuthAndPlayerId($playerName);
$this->player = $playerName;
fclose($this->authIdFile);
}
private function connection()
{
$usermail = urlencode($this->login);
$password = urlencode($this->pw);
$post = "email=".$usermail."&password=".$password."&frm_action=login";
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$header = curl_getinfo( $ch );
curl_close($ch);
unset($ch);
$securestr = explode("/", $header['url']);
$this->authId = $securestr[4];
fclose($this->authIdFile);
$this->authIdFile = fopen('./ramdisk/authid', 'w');
fseek($this->authIdFile, 0);
fputs($this->authIdFile, $this->authId);
}
private function retrieveAuthAndPlayerId($playerName)
{
if(empty($this->authId))
{
$this->connection();
}
$this->retrievePlayerIdFromSite($playerName);
if($this->playerId === 0)
{
$this->connection();
$this->retrievePlayerIdFromSite($playerName);
}
}
private function retrievePlayerIdFromSite($playerName)
{
$ch = curl_init("http://"/.$playerName.".thehunter.com/sid/".$this->authId."/site/statistics/");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
$header = curl_getinfo( $ch );
curl_close($ch);
unset($ch);
if(strpos($header['url'], "reason=no-profile-exists"))
{
$this->playerId = -1;
} elseif($header['url'] == "http://www.thehunter.com/pub/")
{
$this->playerId = 0;
} else {
$useridpos = strpos($response, "onclick=") + 12;
$this->playerId = substr($response, $useridpos, 11);
}
}
public function getPlayerId()
{
return $this->playerId;
}
public function getAuthId()
{
return $this->authId;
}
public function getPlayerName()
{
return $this->player;
}
public function isValid()
{
return (!empty($this->authId) && !empty($this->playerId) && $this->playerId != -1);
}
}
?>
Hope you can help me out with this....it did work 2 months ago!
Regards
Anders
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Murias O'Ceallagh | 22 Dec 22:27
Favicon

curl, php, and cookies

Hello,

I'm currently working on a Drupal site that is to have vBulletin content piped / streamed through it.  This is all to be done with cURL, and have had moderate success so for with this.  I'm having some serious issues though with the cookies the vBulletin cookies.

I am relying upon a Drupal module to handle login to vBulletin, it provides a one login solution.  It builds and then sets the vBulletin cookie.  I then am using curl to bring the vBulletin content through the Drupal front end.

To be clear though, I am writing my test / proof of concept scripts outside the realm of Drupal initially, to ensure any issues I might incur would be my code and not the Drupal API.  ;^)

When I run my script after successful login, the resulting page is one for a guest visitor, not logged in.

I looked at the cookies.txt file that gets written to the server by curl... here is it's contents:
# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.

.developyour.net        TRUE    /       FALSE   1356124217      bb_lastvisit    1324588217
.developyour.net        TRUE    /       FALSE   1356124276      bb_lastactivity 0

Well, these are not all of the cookies that get set for vBulletin to use to verify user credentials.
print_r output of $_COOKIE results in:
[__utmz] => 3248677.1323197046.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) [__utma] => 3248677.60611263.1323197046.1323903616.1324539537.10 [bb_languageid] => 1 [bb_password] => 799761acf1bfd90d7f73c2affc67eebc [bb_userid] => 5 [bb_lastactivity] => 1324539572 [bb_lastvisit] => 1324539572 [bb_sessionhash] => 06b2a574a6a2e6987d8fb46f28bd3037 [SESSfc831485ad71818189e3007e48b9ef98] => 8q9k5jngi223aplrqoomjkr865 [PHPSESSID] => olvmm0o0o9mgi04qtr4hdi1211 [has_js] => 1


All the "bb_" are set by the login module I am using.  They have the proper domain prefix of "." .  They are needed by vBulletin for vBulletin to know I am actually logged into the system, and treat me as such.

Here is my code:

<?php

echo "<pre>";
print_r($_COOKIE);
echo "</pre>";

if(isset($_SERVER['HTTP_USER_AGENT']))
{
$agent = $_SERVER['HTTP_USER_AGENT'];
echo "<br>".$agent."<br>";
}

$crl = curl_init();
    curl_setopt($crl, CURLOPT_URL, $url);
    curl_setopt($crl, CURLOPT_COOKIESESSION, true);
    curl_setopt($crl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
    curl_setopt($crl, CURLOPT_COOKIEJAR, "/tmp/cookie.txt");
    curl_setopt($crl, CURLOPT_USERAGENT, $agent);
    curl_setopt ($crl, CURLOPT_TIMEOUT, '10');
    curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($crl, CURLOPT_REFERER, "http://developyour.net/ThoughtMatrix/forums4/index.php");
    curl_setopt($crl, CURLOPT_POST, 1);
    $result=curl_exec($crl);
   
    print $result;
    
    curl_close($crl);
    
?>

How can I get those other cookies into the cookie txt file?  Have I missed something in my learning and understanding of curl? 

Thank you much in the time to read this.
Cheers
Murias O'Ceallagh
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Paul Menzel | 21 Dec 18:02

SSL read errno 10054

Hi,

I'm a newbie trying consume a web service using PHP & curl.

The PHP is executed on a Windows 2003 server with curl version 7.20.0 installed.

This error message follows the GET:  

        SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054 

Any help resolving this error is much appreciated.

Paul Menzel

 
* About to connect() to some.edu port 443 (#0) 
* Trying xxx.xxx.xxx.xxx… 
* connected * Connected to some.edu (xxx.xxx.xxx.xxx) port 443 (#0) 
* successfully set certificate verify locations: 
* CAfile: C:\somedir\some.crt  CApath: none 
* SSL connection using AES128-SHA 
* Server certificate: 
* subject: C=US; ST=somestate; L=somecity; O=somecollege; OU=GSchool; CN=some.edu 
* start date: 2011-07-18 00:00:00 GMT * expire date: 2014-07-22 12:00:00 GMT * subjectAltName: some.edu
matched 
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert High Assurance CA-3 
* SSL certificate verify ok.
 > GET /gd_appl/1.0/DEPT HTTP/1.1 User-Agent: PHP Sample Rest Client Host: some.edu Accept: */* 

* SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054 

* Empty reply from server 
* Connection #0 to host some.edu left intact 
* Closing connection #0

[IP addresses & other identifying info obscured]
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

-Sys Adm- | 16 Dec 02:41
Picon

Reading/Writing to the same file via FTP...

All I need to do in PHP is:

READ the contents of a file on my FTP server.  (Contents of file are only a single number, 0 - 12)
Add that to a $variable string
Change that $variable and re-write the contents to the same file I READ from.

I am currently READING the contents of the file and adding that to a $variable perfectly using this function:

$expire = "filename";

function read_file($expire)
        {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, "ftp://"location"/".$expire);
            curl_setopt($curl, CURLOPT_USERPWD, "U:P");
            curl_setopt($curl, CURLOPT_HEADER, 0);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
            curl_setopt($curl, CURLOPT_TIMEOUT, 20);
            $data = curl_exec($curl);
            curl_close($curl);
            if ($data != false){
                return $data;
                }else{
                echo 'ERROR';
               }
        }
            $content = read_file($expire);


As far as WRITING the $new_content variable back to the same file, I am completely lost on finding any examples of this....

My assumption would be:

$expire = "filename";
$content = $new_contents;

function write_file($expire)
           $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, "ftp://"location"/".$expire);
            curl_setopt($curl, CURLOPT_USERPWD, "U:P");
            curl_setopt($curl, CURLOPT_HEADER, 0);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

    //this is where I am completely lost...
            curl_setopt($curl, CURLOPT_WRITEFUNCTION, "$new_contents?");
            curl_setopt($curl, CURLOPT_WRITEDATA, "$new_contents?");
    //
            curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
            curl_setopt($curl, CURLOPT_TIMEOUT, 20);
            $data = curl_exec($curl);
            curl_close($curl);
            if ($data != false){
                return $data;
                }else{
                echo 'ERROR';
                }
        }


I have read that cURL does NOT need the fopen, fwrite, fclose calls in order to write data to a file? And I have also read about the CURLOPT_WRITEFUNCTION call, and that is where I am not sure how to WRITE the new contents of the $new_contents variable???

A simple example on the cURL PHP example would be wonderful.

I apologize in advance for my lack of PHP or cURL knowledge.  I am working on this project for a commercial business, and I am the smartest one employed here!!

Thanks in advance...
SysAdm






_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Petar Koretić | 8 Dec 14:57
Picon

PHP - CURL - Microsoft Sharepoint Server 2010 - Authorization

About my server support that i think is relevant
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHP Version 5.3.3-7+squeeze3
CURL : 7.21.0
Features
NTLM Yes
Protocols dict, file, ftp, ftps, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

i'm trying to connect to a SharePoint site which requires authorization that, truthfully, i don't know nothing about anymore, it seems like it's modified (same user and pass for all of us, not local, 'remember me' doesn't work)
anyway, i used libcurl many times and had no problem on various sites, and google and documentation say i should have much of a problem now neither

the problem i'm facing is that curl doesn't post, i don't even get an error, php just echoes page back even if i use same code i used on other sites for authentication

(i can provide code i'm using but i don't think that would do much)

so how do i make successful authorization (or even failed post) based on this real request (this is real data made by browser, user and password aren't of course)
this is successful post with source option rather than parsed
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1. Request URL:
  2. Request Method:
    POST
  3. Status Code:
    302 Found
  4. Request Headersview parsed
    1. POST /_layouts/login.aspx?ReturnUrl=%2f HTTP/1.1 Host: wssim.t.ht.hr Connection: keep-alive Content-Length: 818 Cache-Control: max-age=0 Origin: https://wssim.t.ht.hr User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2 Content-Type: application/x-www-form-urlencoded Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  5. Query String Parametersview URL encoded
    1. ReturnUrl:
      /
  6. Form Dataview URL encoded
    1. __LASTFOCUS:
    2. __VIEWSTATE:
      /wEPDwUKMTc0NDQ2ODg4OQ9kFgJmD2QWAmYPZBYCAgMPZBYCAjUPZBYCAgEPPCsACgEADxYCHghVc2VyTmFtZQUEdGVzdGQWAmYPZBYGAgEPDxYCHgRUZXh0BYABUG9zbHXFvml0ZWxqIHZhcyBuaWplIG1vZ2FvIHByaWphdml0aS4gUHJvdmplcml0ZSBqZXN0ZSBsaSB1bmlqZWxpIGlzcHJhdm5vIGtvcmlzbmnEjWtvIGltZSBpIGxvemlua3UgaSB6YXRpbSBwb2t1xaFhanRlIHBvbm92by5kZAIFDw8WAh8BBQR0ZXN0ZGQCDQ8QDxYCHgdDaGVja2VkaGRkZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFJmN0bDAwJFBsYWNlSG9sZGVyTWFpbiRsb2dpbiRSZW1lbWJlck1lbfiRaFA/QrH2xtLcNAnzU9alXhs=
    3. __EVENTTARGET:
    4. __EVENTARGUMENT:
    5. __EVENTVALIDATION:
      /wEWBQKOlpeQBwLE96mtBQLLtsPBAgLkkP7MCgK/lZyyB7lmGymvBTkJ 5Kj2eetXLC6PRyy
    6. ctl00$PlaceHolderMain$login$UserName: user
    7. ctl00$PlaceHolderMain$login$password: password
    8. ctl00$PlaceHolderMain$login$login:
      Prijava
    9. __spDummyText1:
    10. __spDummyText2:
  7. Response Headersview parsed
    1. HTTP/1.1 302 Found Cache-Control: private Content-Length: 9422 Content-Type: text/html; charset=utf-8 Location: / Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 Set-Cookie: .ASPXAUTH=7B91D01172F6C5F5215071BFBA499E9D97E7E2C75A88CDBC41B3EE99DFABFC623338D0FB7794B39D33251703FAFECEFEDAC1A74AE2E0EF1DD93E3861CA768E6D919CF7098248DA74A65FF4B5F38554CF45C48460FCCBEA836EC34D195709D55EC536BF1E322DF336B421CFD2087247D6CC14E93D; path=/; HttpOnly X-Powered-By: ASP.NET MicrosoftSharePointTeamServices: 12.0.0.6421 Date: Thu, 08 Dec 2011 13:24:14 GMT
----------------------------------------------------------------------------------------------------------------------------------
and this is the unsuccessful request (no user&pass in input fields)
parsed options
---------------------------------------------------------------------------------------------------------------------------------
  1. Request URL:
  2. Request Method:
    POST
  3. Status Code:
    200 OK
  4. Request Headersview source
    1. Accept:
      text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    2. Accept-Charset:
      ISO-8859-1,utf-8;q=0.7,*;q=0.3
    3. Accept-Encoding:
      gzip,deflate,sdch
    4. Accept-Language:
      en-US,en;q=0.8
    5. Cache-Control:
      max-age=0
    6. Connection:
      keep-alive
    7. Content-Length:
      558
    8. Content-Type:
      application/x-www-form-urlencoded
    9. Host:
    10. Origin:
    11. Referer:
    12. User-Agent:
      Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
  5. Query String Parametersview URL encoded
    1. ReturnUrl:
      /
  6. Form Dataview URL encoded
    1. __LASTFOCUS:
    2. __VIEWSTATE:
      /wEPDwUKMTc0NDQ2ODg4OQ9kFgJmD2QWAmYPZBYCAgMPZBYCAjUPZBYCAgEPZBYCZg9kFgICDQ8QDxYCHgdDaGVja2VkaGRkZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFJmN0bDAwJFBsYWNlSG9sZGVyTWFpbiRsb2dpbiRSZW1lbWJlck1lyBvugVHSL6dRxUgDGmWJOn4ReLo=
    3. __EVENTTARGET:
    4. __EVENTARGUMENT:
    5. __EVENTVALIDATION:
      /wEWBQK/vPf6CwLE96mtBQLLtsPBAgLkkP7MCgK/lZyyBzrGvaVwXdg1oTe7Cm Th3D/RMdY
    6. ctl00$PlaceHolderMain$login$UserName:
    7. ctl00$PlaceHolderMain$login$password:
    8. ctl00$PlaceHolderMain$login$login:
      Prijava
    9. __spDummyText1:
    10. __spDummyText2:
  7. Response Headersview source
    1. Cache-Control:
      private
    2. Content-Encoding:
      gzip
    3. Content-Length:
      3912
    4. Content-Type:
      text/html; charset=utf-8
    5. Date:
      Thu, 08 Dec 2011 13:36:00 GMT
    6. MicrosoftSharePointTeamServices:
      12.0.0.6421
    7. Server:
      Microsoft-IIS/7.0
    8. Vary:
      Accept-Encoding
    9. X-AspNet-Version:
      2.0.50727
    10. X-Powered-By:










_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Dusty Reagan | 12 Nov 00:09
Gravatar

How can I disable AsynchDNS?

I have suspicions curl's AsynchDNS is causing me problems, and I'd like to turn it off to investigate, but I can't seem to find any clear method of doing that. Is there a php.ini setting I can use to disable it?
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Eric & Sherrell | 31 Oct 14:52
Picon
Favicon

SMTP with TSL

Hi everyone,

I've been trying to use cURL with a tsl connection to an smtp server.  I've found the following problems:

1.  PHP curl with telnet and tsl can't connect.  Anyone know how to do this?
2.  There seems to be no SMTP support with the php libraries.  However I saw this example for libcurl: 
http://curl.haxx.se/libcurl/c/smtp-tls.html.  Does this mean it might be coming?

Hacked Solution:
Using curl with an https connection I was able to find a hack that allowed me to send out simple SMTP messages
by putting the entire smtp command strings and message into the customrequest field setting when
connecting to the server.  Example snipit:

        curl_setopt($this->curl_handle, CURLOPT_URL, "https://$this->host:$this->port";);
        curl_setopt($this->curl_handle, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($this->curl_handle, CURLOPT_SSL_VERIFYHOST, true);
        curl_setopt($this->curl_handle, CURLOPT_CAINFO, "cacert.pem"); // local root CA copy
        curl_setopt($this->curl_handle, CURLOPT_CAPATH, "./");
        curl_setopt($this->curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($this->curl_handle, CURLOPT_HTTPHEADER, "");

        $out = "AUTH LOGIN\r\n";
        $out .= base64_encode($this->user) . "\r\n";
        $out .= base64_encode($this->password) . "\r\n";
        $out .= "MAIL FROM: <$from>\r\n";
        $out .= "RCPT TO: <$to>\r\n";
        $out .= "DATA\r\n";
        $out .= "To: $to\r\n";
        $out .="From: $from\r\n";
        $out .="Subject:  $subject\r\n\r\n";
        $out .=$message;
        $out .="\r\n.\r\n";
        $out .="QUIT\r\n";

        curl_setopt($this->curl_handle, CURLOPT_CUSTOMREQUEST, $out . "\r\n");
        curl_exec($this->curl_handle);

Since this is using the HTTP/HTTPS protocol, curl appends / http 1.0\nAllow */*\n to the end of the
customrequest, but this gets ignored by the SMTP server after the QUIT is encountered.  A more detailed
discussion can be found here http://forums.devnetwork.net/viewtopic.php?f=1&t=132442&p=663872#p663872

If you have any more stable ideas or solutions, I would love to hear them.

Regards,
Eric

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Nelson Johnson | 22 Oct 14:28
Picon

Help

Hello,

I have some problems to understand cURL. I wrote a get request for google.com
This request is working fine but my browser Im using is sending some other requests too.

The request I wrote is: GET / HTTP/1.1 for http://www.google.com/
Now the browser does requests like:

GET /logos/2011/liszt11-hp.jpg HTTP/1.1

or

GET /generate_204 HTTP/1.1

How can I send these requests with cURL as well and echo the site then?

Thanks for your help :)


_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
William Betts | 22 Oct 09:28
Picon

php, curl, and smtp

Hello,

Is there any plans on incorporating smtp, imap, and pop3 into the php curl library?

Best Regards,
William

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
- RaZVy* | 26 Sep 17:33
Picon
Favicon

Passing swf flash vars using curl?

Hello. Is it possible to pass flash vars to a swf file using curl? 
I tried with 
<?php
   header("content-type: application/x-shockwave-flash" );
  $url = "http://mywebiste.com/videoPlayer.swf?settingsFile=st.xml"; 
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

  $result = curl_exec($ch); 

  curl_close($ch);
  echo $result; 
?> 
Also tried with post fields stil it didn't work. I tried the above with a php file that reads the videoPlayer.php and the same result. 
Dose anybody know the answer?Thanks
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Gmane