RE: [PHP] Please, I need help with curl and php
| From: | Wei, Alice J. | Date: | Tue, 29 Jul 2008 14:49:10 +0000 |
| Subject: | RE: [PHP] Please, I need help with curl and php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277424@lists.php.net to get a copy of this message | ||
Hi, I´m making a little application with php and curl, but I´m a newby with
curl.
Please help me with the next script.
I used to use this in order to make a connection with an specific site on
the console ms-dos (windows), how can i translate this into php code?
curl -x proxy_url:proxy_port -U proxy_user:proxy_pass --cert
cert.pem:cert_pass --cert-type PEM -k -c cookie.txt -d
"txtUser=user_loguin&txtPass=pass_loguin"
url_required<https://renat.segob.gob.mx/AppRNT/validacion/valida.php>
I tried with this, but it doesn't work fine
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $f_path);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxurl);
curl_setopt($ch,CURLOPT_PROXYPORT,$proxport);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_CAINFO, $fichero);
curl_setopt($ch, CURLOPT_PROXYUSERPWD,
"'".$proxyu.":".$proxyp."'");
curl_setopt($ch,CURLOPT_SSLCERT,$fichero);
curl_setopt($ch,CURLOPT_SSLCERTTYPE, "pem");
curl_setopt($ch,CURLOPT_SSLCERTPASSWD,$pcert);
curl_setopt($ch,CURLOPT_USERPWD,"'".$usr.":".$pwd."'");
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
$HTTP_Response1 = curl_exec($ch);
Thanks and recards
Have you tried taking $HTTP_Response1 out and just execute the curl by doing curl_exec($ch)?
It seems to me that it is initiating, but it is not calling or executing anything.
This is what I have when I use curl
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
Hope this helps.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu