[PHP] Curl problems

2012-01-11 Thread Rick Dwyer

Hello all.

I use curl to make a call to another page on my site... but it  
operates erroneously sometimes working... sometimes not.  The page  
it calls creates an email and I can see on the server the email in the  
queue when it's working.  If I echo out the URL the curl command is  
supposed to load and load it manually, it works without fail.


Any help on what I am doing wrong below is greatly appreciated.

Thanks.


$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id) 
;

curl_exec($curl_handle);
curl_close($curl_handle);

 --Rick



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



Re: [PHP] Curl problems

2012-01-11 Thread Matijn Woudt
On Thu, Jan 12, 2012 at 12:20 AM, Rick Dwyer rpdw...@earthlink.net wrote:
 Hello all.

 I use curl to make a call to another page on my site... but it operates
 erroneously sometimes working... sometimes not.  The page it calls
 creates an email and I can see on the server the email in the queue when
 it's working.  If I echo out the URL the curl command is supposed to load
 and load it manually, it works without fail.

 Any help on what I am doing wrong below is greatly appreciated.

 Thanks.


 $curl_handle=curl_init();
 curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
 curl_exec($curl_handle);
 curl_close($curl_handle);

  --Rick

It's maybe not a real answer to your question, but if all you want to
do is call that page, why don't you just use
file_get_contents(https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
(See [1])
It works out of the box, and I have found curl unstable too sometimes.

Matijn

[1] www.php.net/file_get_contents

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



Re: [PHP] Curl problems

2012-01-11 Thread Rick Dwyer

On Jan 11, 2012, at 6:29 PM, Matijn Woudt wrote:

On Thu, Jan 12, 2012 at 12:20 AM, Rick Dwyer rpdw...@earthlink.net  
wrote:

Hello all.

I use curl to make a call to another page on my site... but it  
operates
erroneously sometimes working... sometimes not.  The page it  
calls
creates an email and I can see on the server the email in the queue  
when
it's working.  If I echo out the URL the curl command is supposed  
to load

and load it manually, it works without fail.

Any help on what I am doing wrong below is greatly appreciated.

Thanks.


$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id) 
;

curl_exec($curl_handle);
curl_close($curl_handle);

 --Rick


It's maybe not a real answer to your question, but if all you want to
do is call that page, why don't you just use
file_get_contents(https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id 
);

(See [1])
It works out of the box, and I have found curl unstable too sometimes.

Matijn


Thanks Matijn,
But I get Notice: file_get_contents() [function.file-get-contents]:  
Unable to find the wrapper https - did you forget to enable it when  
you configured PHP?... I'm using a hosting provider and I don't  
believe they will enable this for security reasons.


--Rick



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



Re: [PHP] Curl problems

2012-01-11 Thread Matijn Woudt
On Thu, Jan 12, 2012 at 12:44 AM, Rick Dwyer rpdw...@earthlink.net wrote:
 On Jan 11, 2012, at 6:29 PM, Matijn Woudt wrote:

 On Thu, Jan 12, 2012 at 12:20 AM, Rick Dwyer rpdw...@earthlink.net
 wrote:

 Hello all.

 I use curl to make a call to another page on my site... but it operates
 erroneously sometimes working... sometimes not.  The page it calls
 creates an email and I can see on the server the email in the queue when
 it's working.  If I echo out the URL the curl command is supposed to load
 and load it manually, it works without fail.

 Any help on what I am doing wrong below is greatly appreciated.

 Thanks.


 $curl_handle=curl_init();

 curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
 curl_exec($curl_handle);
 curl_close($curl_handle);

  --Rick


 It's maybe not a real answer to your question, but if all you want to
 do is call that page, why don't you just use

 file_get_contents(https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
 (See [1])
 It works out of the box, and I have found curl unstable too sometimes.

 Matijn


 Thanks Matijn,
 But I get Notice: file_get_contents() [function.file-get-contents]: Unable
 to find the wrapper https - did you forget to enable it when you
 configured PHP?... I'm using a hosting provider and I don't believe they
 will enable this for security reasons.

 --Rick

It seems like they have not compiled PHP with SSL support, or they're
using a pretty old version. Anyway, you're probably stuck with cURL
then, check the return of curl_exec, and if false, call curl_error to
get an error message.

Matijn

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



Re: RES: [PHP] CURL problems still

2009-05-12 Thread Miller, Terion


 Bastien, could you give me an example of what you mean?
 would it be $Name = 

 like that?

 Thanks for the ideas everyone!


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


 Try Imitliazing the variables at the top of the loop to empty strings
 or zeros

 Bastien



Yep, that's it

$_thing = '';


Bastien


Well I tried it and still it stopped at the C's maybe I put them in the wrong 
spot?  I tried something yesterday where I commented out the C's url, and it 
ran through the F's could a setting somewhere be restricting how many files 
it can run...I am just stumped, the script runs fine, inserts the data I'm 
wanting etc, just can't get it to run all 26 pagesargh.

Code--
foreach($html-find('table') as $table) {foreach($table-find('tr') as $tr) 
   {  //set variables to nada ? $name = ''; $age = ''; $warrant = 
''; $bond = ''; $wnumber = ''; $crime = '';// Grab 
children   $cells = $tr-children();  
if($cells[0]-plaintext != Name){for ($i = 0; $i 
 count($cells); $i++){  switch 
($i){ case 0: // Name $name = 
$cells[$i]-plaintext; echo $cells[$i]-plaintext;  
   break; case 1: // Age $age = 
$cells[$i]-plaintext; break; case 2: // 
Warrant type $warrant = $cells[$i]-plaintext;  
   break; case 3: // Bond amount $bond 
= $cells[$i]-plaintext; break; case 4: // 
Warrant number $wnumber = $cells[$i]-plaintext;
 break;  case 5: // Offence description 
$crime = $cells[$i]-plaintext; break; 
Default: echo Uh-ohbr /; }  
 }  
 }// Build your INSERT statement here  
$query = INSERT into `warrants` (name, age, warrant, bond, wnumber, crime) 
VALUES (;$query .=  '$name', '$age', '$warrant', '$bond', '$wnumber', 
'$crime' );$wid = mysql_insert_id();echo $query;   
 // run query mysql_query($query) or die (mysql_error());

-end code---

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



Re: RES: [PHP] CURL problems still

2009-05-12 Thread Nathan Rixham

Miller, Terion wrote:


Well I tried it and still it stopped at the C's


1:
your script is timing out, you need to set the time limit higher
set_time_limit(0);

2:
foreach($html-find('table') as $table) {
$rows = explode('/tr' , $table );
$headerCells = explode('/th', array_shift($rows));
$struct = array();
foreach( $headerCells as $c = $cell ) {
  $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ;
}
$data = array();
foreach( $rows as $r = $row ) {
  $cells = explode( '/td' , $row );
  $item = array();
  foreach( $cells as $c = $cell ) {
$item[$struct[$c]] = trim(strip_tags( $cell ));
  }
  $data[] = $item;
  $query = INSERT into `warrants` ;
  $query .= (name, age, warrant, bond, wnumber, crime);
  $query .=  VALUES (;
  $query .=  '{$item['name']}',;
  $query .=  '{$item['age']}',;
  $query .=  '{$item['warrant_type']}',;
  $query .=  '{$item['bond']}',;
  $query .=  '{$item['warrant_number']}',;
  $query .=  '{$item['offence_description']}';
  $query .=  );
  echo $query . \n;
  // run query here
}
}

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



Re: RES: [PHP] CURL problems still

2009-05-12 Thread Nathan Rixham

Nathan Rixham wrote:

Miller, Terion wrote:


Well I tried it and still it stopped at the C's


1:
your script is timing out, you need to set the time limit higher
set_time_limit(0);

2:
foreach($html-find('table') as $table) {
$rows = explode('/tr' , $table );
$headerCells = explode('/th', array_shift($rows));
$struct = array();
foreach( $headerCells as $c = $cell ) {
  $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ;
}
$data = array();
foreach( $rows as $r = $row ) {
  $cells = explode( '/td' , $row );
  $item = array();
  foreach( $cells as $c = $cell ) {
$item[$struct[$c]] = trim(strip_tags( $cell ));
  }
  $data[] = $item;
  $query = INSERT into `warrants` ;
  $query .= (name, age, warrant, bond, wnumber, crime);
  $query .=  VALUES (;
  $query .=  '{$item['name']}',;
  $query .=  '{$item['age']}',;
  $query .=  '{$item['warrant_type']}',;
  $query .=  '{$item['bond']}',;
  $query .=  '{$item['warrant_number']}',;
  $query .=  '{$item['offence_description']}';
  $query .=  );
  echo $query . \n;
  // run query here
}
}


3:
If this is your own site then don't read on, but if it's not your own 
site and this is a paid job for a client then..


do you not think there is something a bit wrong about taking on work 
which you obviously can't do, telling the client you can, then 
continually asking hard working people to take time out from their own 
working days to both teach you and complete your work for you?


There is such an increase in people just saying I know PHP taking on 
work then getting the helpful people on this list and others to do it 
for them, and it really really sucks. If you can't do the work don't 
take it on, if you get genuinely stuck then ask - but don't just copy 
and paste a clients job description here with some random code and 
expect others to do it for you.


In the time you've spent asking and waiting, you could have learnt how 
to do it yourself.



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



RES: RES: [PHP] CURL problems still

2009-05-12 Thread Jônatas Zechim
Hi Terion,

I thing the problems is the time limit on your Server.

Try this now:

Test the var before insert into db:
If(!isset($crime)){$crime=''}

After u remove from the db the unwanted lines.

On the end of the file u do this:

$letters=array();
for($i='A';$i='Z';$i++){$letters[$i]=$i;if($i=='Z'){break;}}
$tL=count($letters);
$letters=array_keys($letters);

if(isset($_GET['L'])){if(trim($_GET['L'])!==''){if($_GET['L']+1$tL){$next=0
;$final=1;}else{$next=$_GET['L'];}}else{$next=0;}}else{$next=0;}

$nextLetter=$letters[$next];

if(!isset($final)){

//do the task


//on the end of the file u put this:


for($i=0;$i$tL;$i++){if($nextLetter==$letters[$i]){if($i+1==$tL){$nextLette
r=0;$file='A';}else{$nextLetter=$i+1;$file=$letters[$i+1];}break;}}
#header('Location:'.$file.'.php?L='.$nextLetter);
}

U'll need to make A.php, B.php, C.php, D.php, etc... file, with the same
content., did u get it?
 
Zechim


-Mensagem original-
De: Miller, Terion [mailto:tmil...@springfi.gannett.com] 
Enviada em: terça-feira, 12 de maio de 2009 10:24
Para: Phpster; Miller, Terion
Cc: Jônatas Zechim; PHP-General List
Assunto: Re: RES: [PHP] CURL problems still



 Bastien, could you give me an example of what you mean?
 would it be $Name = 

 like that?

 Thanks for the ideas everyone!


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


 Try Imitliazing the variables at the top of the loop to empty strings
 or zeros

 Bastien



Yep, that's it

$_thing = '';


Bastien


Well I tried it and still it stopped at the C's maybe I put them in the
wrong spot?  I tried something yesterday where I commented out the C's
url, and it ran through the F's could a setting somewhere be restricting
how many files it can run...I am just stumped, the script runs fine, inserts
the data I'm wanting etc, just can't get it to run all 26 pagesargh.

Code--
foreach($html-find('table') as $table) {foreach($table-find('tr') as
$tr){  //set variables to nada ? $name = ''; $age = '';
$warrant = ''; $bond = ''; $wnumber = ''; $crime = '';
// Grab children   $cells = $tr-children();
if($cells[0]-plaintext != Name){for ($i = 0;
$i  count($cells); $i++){
switch ($i){ case 0: // Name $name =
$cells[$i]-plaintext; echo $cells[$i]-plaintext;
break; case 1: // Age $age =
$cells[$i]-plaintext; break; case 2: //
Warrant type $warrant = $cells[$i]-plaintext;
break; case 3: // Bond amount $bond =
$cells[$i]-plaintext; break; case 4: //
Warrant number $wnumber = $cells[$i]-plaintext;
break;  case 5: // Offence description
$crime = $cells[$i]-plaintext; break;
Default: echo Uh-ohbr /; }
}   }// Build your
INSERT statement here  $query = INSERT into `warrants` (name,
age, warrant, bond, wnumber, crime) VALUES (;$query .=  '$name',
'$age', '$warrant', '$bond', '$wnumber', '$crime' );$wid =
mysql_insert_id();echo $query;// run query
mysql_query($query) or die (mysql_error());

-end code---


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



[PHP] CURL problems still

2009-05-11 Thread Miller, Terion
I'm back.  I thought I had this script working but it seems to always stop
at the end of the C's, so I can get it to go thru pages A-C then it stops, I
have tried setting the time-out to a very large amount but it never
continues to run past the same spot, it gathers all records to the end of C,
then quits...any ideas?

Script: 

?php

ini_set('display_errors',
1);
include(inc/dbconn_open.php);

include(inc/dom.php);

error_reportin
g(E_ALL);

$TESTING = TRUE;


 $targets[a] =
http://www.greenecountymo.org/sheriff/warrants.php?search=A;;

$targets[b] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=B;;

$targets[c] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=C;;

$targets[d] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=D;;

$targets[e] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=E;;

$targets[f] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=F;;

$targets[g] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=G;;

$targets[h] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=H;;

$targets[i] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=I;;

$targets[j] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=J;;

$targets[k] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=K;;

$targets[l] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=L;;

$targets[m] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=M;;

$targets[n] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=N;;

$targets[o] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=O;;

$targets[p] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=P;;

$targets[q] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=Q;;

$targets[r] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=R;;

$targets[s] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=S;;

$targets[t] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=T;;

$targets[u] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=U;;

$targets[v] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=V;;

$targets[w] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=W;;

$targets[x] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=X;;

$targets[y] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=Y;;

$targets[z] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=Z;;
 
 foreach
($targets as $target_url){

echo $target_url;

$userAgent = 'Googlebot/2.1
(http://www.googlebot.com/bot.html)';


$ch = curl_init();
curl_setopt($ch,
CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch,
CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_FAILONERROR,
true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch,
CURLOPT_AUTOREFERER, true);
curl_setopt($ch,
CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT,
6000);

$html = curl_exec($ch);

if (!$html) {
echo br /cURL error
number: .curl_errno($ch);
echo br /cURL error: . curl_error($ch);

exit;
}


// Create DOM from URL or file
$html =
file_get_html($target_url);

// Find table
foreach($html-find('table') as
$table)
{
foreach($table-find('tr') as $tr)
{
   
   

// Grab children
   $cells = $tr-children();
  

if($cells[0]-plaintext != Name)
{

for ($i =
0; $i  count($cells); $i++)
{
 

switch ($i){
 case 0: // Name
 $name =
$cells[$i]-plaintext;
 echo $cells[$i]-plaintext;

break;
 case 1: // Age
 $age =
$cells[$i]-plaintext;
 break;
 case 2:
// Warrant type
 $warrant = $cells[$i]-plaintext;

break;
 case 3: // Bond amount
 $bond =
$cells[$i]-plaintext;
 break;
 case 4:
// Warrant number
 $wnumber = $cells[$i]-plaintext;

break;
 case 5: // Offence description

$crime = $cells[$i]-plaintext;
 break;

Default:
 echo Uh-ohbr /;
 }

 
 
}

   

}
   

 // Build your INSERT statement here

// Build your INSERT statement here
  
$query = INSERT
into warrants (wid, name, age, warrant, bond, wnumber, crime) VALUES (;

$query .=  '$wid', '$name', '$age', '$warrant', '$bond', '$wnumber',
'$crime' );
//$wid = mysql_insert_id();

echo
$query;

// run query
 mysql_query($query) or die
(mysql_error());
}
   
  }


}


?



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



RES: [PHP] CURL problems still

2009-05-11 Thread Jônatas Zechim
Hey Guy, try to change the 'max_execution_time'

ini_set('max_execution_time','1800');



-Mensagem original-
De: Miller, Terion [mailto:tmil...@springfi.gannett.com] 
Enviada em: segunda-feira, 11 de maio de 2009 16:41
Para: PHP-General List
Assunto: [PHP] CURL problems still 

I'm back.  I thought I had this script working but it seems to always stop
at the end of the C's, so I can get it to go thru pages A-C then it stops, I
have tried setting the time-out to a very large amount but it never
continues to run past the same spot, it gathers all records to the end of C,
then quits...any ideas?

Script: 

?php

ini_set('display_errors',
1);
include(inc/dbconn_open.php);

include(inc/dom.php);

error_reportin
g(E_ALL);

$TESTING = TRUE;


 $targets[a] =
http://www.greenecountymo.org/sheriff/warrants.php?search=A;;

$targets[b] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=B;;

$targets[c] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=C;;

$targets[d] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=D;;

$targets[e] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=E;;

$targets[f] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=F;;

$targets[g] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=G;;

$targets[h] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=H;;

$targets[i] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=I;;

$targets[j] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=J;;

$targets[k] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=K;;

$targets[l] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=L;;

$targets[m] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=M;;

$targets[n] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=N;;

$targets[o] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=O;;

$targets[p] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=P;;

$targets[q] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=Q;;

$targets[r] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=R;;

$targets[s] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=S;;

$targets[t] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=T;;

$targets[u] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=U;;

$targets[v] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=V;;

$targets[w] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=W;;

$targets[x] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=X;;

$targets[y] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=Y;;

$targets[z] = 
http://www.greenecountymo.org/sheriff/warrants.php?search=Z;;
 
 foreach
($targets as $target_url){

echo $target_url;

$userAgent = 'Googlebot/2.1
(http://www.googlebot.com/bot.html)';


$ch = curl_init();
curl_setopt($ch,
CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch,
CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_FAILONERROR,
true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch,
CURLOPT_AUTOREFERER, true);
curl_setopt($ch,
CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT,
6000);

$html = curl_exec($ch);

if (!$html) {
echo br /cURL error
number: .curl_errno($ch);
echo br /cURL error: . curl_error($ch);

exit;
}


// Create DOM from URL or file
$html =
file_get_html($target_url);

// Find table
foreach($html-find('table') as
$table)
{
foreach($table-find('tr') as $tr)
{
   
   

// Grab children
   $cells = $tr-children();
  

if($cells[0]-plaintext != Name)
{

for ($i =
0; $i  count($cells); $i++)
{
 

switch ($i){
 case 0: // Name
 $name =
$cells[$i]-plaintext;
 echo $cells[$i]-plaintext;

break;
 case 1: // Age
 $age =
$cells[$i]-plaintext;
 break;
 case 2:
// Warrant type
 $warrant = $cells[$i]-plaintext;

break;
 case 3: // Bond amount
 $bond =
$cells[$i]-plaintext;
 break;
 case 4:
// Warrant number
 $wnumber = $cells[$i]-plaintext;

break;
 case 5: // Offence description

$crime = $cells[$i]-plaintext;
 break;

Default:
 echo Uh-ohbr /;
 }

 
 
}

   

}
   

 // Build your INSERT statement here

// Build your INSERT statement here
  
$query = INSERT
into warrants (wid, name, age, warrant, bond, wnumber, crime) VALUES (;

$query .=  '$wid', '$name', '$age', '$warrant', '$bond', '$wnumber',
'$crime' );
//$wid = mysql_insert_id();

echo
$query;

// run

Re: RES: [PHP] CURL problems still

2009-05-11 Thread Miller, Terion
The error I get is from my INSERT statement 
It does insert the records up to C page though...
The problem area:

   // Build your INSERT statement here  $query = INSERT into 
warrants (wid, name, age, warrant, bond, wnumber, crime) VALUES (;$query 
.=  '$wid', '$name', '$age', '$warrant', '$bond', '$wnumber', '$crime' ); 
   $wid = mysql_insert_id();echo $query;// run 
query mysql_query($query) or die (mysql_error());

The Error message


Notice: Undefined variable: wid in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124

Notice: Undefined variable: name in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124

Notice: Undefined variable: age in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124

Notice: Undefined variable: warrant in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124

Notice: Undefined variable: bond in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124

Notice: Undefined variable: wnumber in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124

Notice: Undefined variable: crime in 
/var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php 
on line 124



On 5/11/09 2:45 PM, Jônatas Zechim zechim@gmail.com wrote:




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



Re: RES: [PHP] CURL problems still

2009-05-11 Thread Phpster



On May 11, 2009, at 16:01, Miller, Terion tmil...@springfi.gannett.com 
 wrote:



The error I get is from my INSERT statement 
It does insert the records up to C page though...
The problem area:

  // Build your INSERT statement here  $query = INSERT  
into warrants (wid, name, age, warrant, bond, wnumber, crime) VALUES  
(;$query .=  '$wid', '$name', '$age', '$warrant', '$bond',  
'$wnumber', '$crime' );$wid =  
mysql_insert_id();echo $query;// run  
query mysql_query($query) or die (mysql_error());


The Error message


Notice: Undefined variable: wid in /var/www/vhosts/getpublished.news- 
leader.com/httpdocs/Warrants/loopScrape1.php on line 124


Notice: Undefined variable: name in /var/www/vhosts/ 
getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php on  
line 124


Notice: Undefined variable: age in /var/www/vhosts/getpublished.news- 
leader.com/httpdocs/Warrants/loopScrape1.php on line 124


Notice: Undefined variable: warrant in /var/www/vhosts/ 
getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php on  
line 124


Notice: Undefined variable: bond in /var/www/vhosts/ 
getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php on  
line 124


Notice: Undefined variable: wnumber in /var/www/vhosts/ 
getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php on  
line 124


Notice: Undefined variable: crime in /var/www/vhosts/ 
getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.php on  
line 124




On 5/11/09 2:45 PM, Jônatas Zechim zechim@gmail.com wrote:




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



Try Imitliazing the variables at the top of the loop to empty strings  
or zeros


Bastien 
--

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



Re: RES: [PHP] CURL problems still

2009-05-11 Thread Miller, Terion


Bastien, could you give me an example of what you mean?
would it be $Name = 

like that?

Thanks for the ideas everyone!







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


Try Imitliazing the variables at the top of the loop to empty strings
or zeros

Bastien



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



Re: RES: [PHP] CURL problems still

2009-05-11 Thread Phpster



On May 11, 2009, at 17:53, Miller, Terion tmil...@springfi.gannett.com 
 wrote:





Bastien, could you give me an example of what you mean?
would it be $Name = 

like that?

Thanks for the ideas everyone!








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



Try Imitliazing the variables at the top of the loop to empty strings
or zeros

Bastien




Yep, that's it

$_thing = '';


Bastien

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



[PHP] CURL problems posting data

2007-08-22 Thread Rahul Sitaram Johari

Ave,

We need to login to a client¹s website in order to feed some data to their
database, using their forms. To automate it, I¹m trying to use Curl to
login. 

This is their form:
form name=Form1 method=post action=http://www.website.com/Login.aspx;
id=Form1
input type=hidden name=__VIEWSTATE
value=dDwtNDI5NDcwNDM2Ozs+oeS6YcaxMhbb66r8w2jsMzFiezM= /
input name=login:username VALUE=usr type=HIDDEN id=login_username
/
input name=login:password VALUE=pwd type=HIDDEN id=login_password
/
input name=login:txtAffiliateCode VALUE=db type=HIDDEN
id=login_txtAffiliateCode /
input type=submit name=login:loginbutton value=Login
id=login_loginbutton
/form

I¹m not quite sure why their field names have a ³:² and what purpose it
serves, but I just can¹t seem to login using Curl no matter what I try. I¹ve
gone through testing different codes, and this is where I¹m at to make this
work:

?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,http://www.website.com/Login.aspx;);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
urlencode('login:username').=usr.urlencode('login:password').=pwd.urle
ncode('login:txtAffiliateCode').=db.urlencode('__VIEWSTATE').=.urlencod
e('dDwtNDI5NDcwNDM2Ozs+oeS6YcaxMhbb66r8w2jsMzFiezM='));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec ($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
curl_close ($ch);
print_r($result);
?

Needless to say that if I put their form ³as-is² on a page on my server and
specify full URL in ³ACTION², it works.
Why is Curl failing to log me in?

~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²



[PHP] Curl problems

2005-09-22 Thread -k.
Here is my problem. I need to post an XML file to someone else's server. I'm 
trying to do this
with the curl package. 

Once I post the XML file to the other server one of two things will happen. The 
server will either
take the info in the XML file and forward the user along to some other page or 
the page will
return some errors, if for example there is something wrong with the XML i 
send. 

What I would like to do is post the data to the other server and if everything 
is OK just allow
the user to be forwarded along, otherwise I’d like to catch whatever errors the 
server spits back.


Setting this up on two of my development boxes seems to work fine. However when 
I try to send this
to the other server (which i have no control over) it doesn’t work. It's seems 
like it is having
trouble redirecting my request. When I send the request I get a “Server Error 
in '/' Application”
which looks to be like a generic ASP error( I guess). If I comment out the 
FOLLOWLOCATION
curl_setopt line all I get in response, other than headers, is Object moved 
message with a link,
the link however seems like a relative link because if i click on it tries to 
find the linked page
on my server. I'm wondering if something in my request is breaking whatever 
forwarding goes on
internally. 

Stiped to the basics this is my script:
?Php
$url = https://somebody.else.com/this/some_script.aspx;;

$postfields = array();
$postfields['some_xml'] = urlencode($some_xml_ive_generated);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$output = curl_exec($ch);
curl_close($ch);

print $output; 
?

A couple of things:
-I'm pretty new to curl so i could easily be overlooking something.
-The https:// doesn't seem to be the problem
-Generating a form that submits itself with javascript when loaded seems to 
work fine.
-The url in my location bar never seems to change even when i post between my 
two development
boxes and my simple response test script works.
-I have no idea what happens nor any control over the other box. I've e-mailed 
my contact there
with no response.
-The other box is running IIS6 with ASP (or at least that is what headers from 
it claim).
-The https://somebody.else.com/this/some_script.aspx link (the actual one not 
the  one used here
is definitely correct).
-Am i screwing up the headers or something?
-Is what I’m doing even possible?

Any suggestions for things to try? Or simple things I’ve overlooked? I’ve 
googled around and read
a few basic curl tutorials but they haven’t helped me sort this out.

 



-k.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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