RES: RES: RES: RES: [PHP] CURL error help
U r correct! It's ok know. -Mensagem original- De: Shawn McKenzie [mailto:nos...@mckenzies.net] Enviada em: sexta-feira, 8 de maio de 2009 13:34 Para: Miller, Terion Cc: Jônatas Zechim; PHP-General List Assunto: Re: RES: RES: RES: [PHP] CURL error help Miller, Terion wrote: > > > On 5/8/09 10:55 AM, "Jônatas Zechim" wrote: > > Ok, but u need to confirm the $args vars are being passed to that funtion, > because I thing they're blanks. > > Zechim > zechim.com > São Paulo/Brazil > > here is the code from the dom.php file, as it stands currently my error reads: > > > Warning: file_get_contents($target_url) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on line 39 > > Here is the code from dom.php: > > > define('HDOM_TYPE_ELEMENT', 1); > define('HDOM_TYPE_COMMENT', 2); > define('HDOM_TYPE_TEXT',3); > define('HDOM_TYPE_ENDTAG', 4); > define('HDOM_TYPE_ROOT',5); > define('HDOM_TYPE_UNKNOWN', 6); > define('HDOM_QUOTE_DOUBLE', 0); > define('HDOM_QUOTE_SINGLE', 1); > define('HDOM_QUOTE_NO', 3); > define('HDOM_INFO_BEGIN', 0); > define('HDOM_INFO_END', 1); > define('HDOM_INFO_QUOTE', 2); > define('HDOM_INFO_SPACE', 3); > define('HDOM_INFO_TEXT',4); > define('HDOM_INFO_INNER', 5); > define('HDOM_INFO_OUTER', 6); > define('HDOM_INFO_ENDSPACE',7); > > // helper functions > // - > // get html dom from file > function file_get_html() { >$dom = new simple_html_dom; >$args = func_get_args(); >$dom->load(call_user_func_array('file_get_contents', $args), true); >return $dom; > > } > > // get html dom from string > function str_get_html($str, $lowercase=true) { >$dom = new simple_html_dom; >$dom->load($str, $lowercase); >return $dom; > } > > // dump html dom tree > function dump_html_tree($node, $show_attr=true, $deep=0) { >$lead = str_repeat('', $deep); >echo $lead.$node->tag; >if ($show_attr && count($node->attr)>0) { >echo '('; >foreach($node->attr as $k=>$v) >echo "[$k]=>\"".$node->$k.'", '; >echo ')'; >} >echo "\n"; > >foreach($node->nodes as $c) >dump_html_tree($c, $show_attr, $deep+1); > } > > // get dom form file (deprecated) > function file_get_dom() { >$dom = new simple_html_dom; >$args = func_get_args(); >$dom->load(call_user_func_array('file_get_contents', $args), true); >return $dom; > } > > // get dom form string (deprecated) > function str_get_dom($str, $lowercase=true) { >$dom = new simple_html_dom; >$dom->load($str, $lowercase); >return $dom; > } > > I've answered your question. It's not in that file it's in your function call to file_get_html(). You've got your parameter variable in single frigging quotes! -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: RES: RES: [PHP] CURL error help
Miller, Terion wrote: > > > On 5/8/09 10:55 AM, "Jônatas Zechim" wrote: > > Ok, but u need to confirm the $args vars are being passed to that funtion, > because I thing they're blanks. > > Zechim > zechim.com > São Paulo/Brazil > > here is the code from the dom.php file, as it stands currently my error reads: > > > Warning: file_get_contents($target_url) [function.file-get-contents]: failed > to open stream: No such file or directory in > /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on > line 39 > > Here is the code from dom.php: > > > define('HDOM_TYPE_ELEMENT', 1); > define('HDOM_TYPE_COMMENT', 2); > define('HDOM_TYPE_TEXT',3); > define('HDOM_TYPE_ENDTAG', 4); > define('HDOM_TYPE_ROOT',5); > define('HDOM_TYPE_UNKNOWN', 6); > define('HDOM_QUOTE_DOUBLE', 0); > define('HDOM_QUOTE_SINGLE', 1); > define('HDOM_QUOTE_NO', 3); > define('HDOM_INFO_BEGIN', 0); > define('HDOM_INFO_END', 1); > define('HDOM_INFO_QUOTE', 2); > define('HDOM_INFO_SPACE', 3); > define('HDOM_INFO_TEXT',4); > define('HDOM_INFO_INNER', 5); > define('HDOM_INFO_OUTER', 6); > define('HDOM_INFO_ENDSPACE',7); > > // helper functions > // > - > // get html dom from file > function file_get_html() { >$dom = new simple_html_dom; >$args = func_get_args(); >$dom->load(call_user_func_array('file_get_contents', $args), true); >return $dom; > > } > > // get html dom from string > function str_get_html($str, $lowercase=true) { >$dom = new simple_html_dom; >$dom->load($str, $lowercase); >return $dom; > } > > // dump html dom tree > function dump_html_tree($node, $show_attr=true, $deep=0) { >$lead = str_repeat('', $deep); >echo $lead.$node->tag; >if ($show_attr && count($node->attr)>0) { >echo '('; >foreach($node->attr as $k=>$v) >echo "[$k]=>\"".$node->$k.'", '; >echo ')'; >} >echo "\n"; > >foreach($node->nodes as $c) >dump_html_tree($c, $show_attr, $deep+1); > } > > // get dom form file (deprecated) > function file_get_dom() { >$dom = new simple_html_dom; >$args = func_get_args(); >$dom->load(call_user_func_array('file_get_contents', $args), true); >return $dom; > } > > // get dom form string (deprecated) > function str_get_dom($str, $lowercase=true) { >$dom = new simple_html_dom; >$dom->load($str, $lowercase); >return $dom; > } > > I've answered your question. It's not in that file it's in your function call to file_get_html(). You've got your parameter variable in single frigging quotes! -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: RES: RES: RES: [PHP] CURL error help
Look: var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php Is getpublished.news-leader.com really a folder? Are u using mod_rewrite? I do thing u r passing a wrong $args var, can u send me the files on a *.zip? If u can: zechim@gmail.com Zechim zechim.com São Paulo/Brazil -Mensagem original- De: Miller, Terion [mailto:tmil...@springfi.gannett.com] Enviada em: sexta-feira, 8 de maio de 2009 13:19 Para: Jônatas Zechim; Miller, Terion; PHP-General List Assunto: Re: RES: RES: RES: [PHP] CURL error help On 5/8/09 10:55 AM, "Jônatas Zechim" wrote: Ok, but u need to confirm the $args vars are being passed to that funtion, because I thing they're blanks. Zechim zechim.com São Paulo/Brazil here is the code from the dom.php file, as it stands currently my error reads: Warning: file_get_contents($target_url) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on line 39 Here is the code from dom.php: define('HDOM_TYPE_ELEMENT', 1); define('HDOM_TYPE_COMMENT', 2); define('HDOM_TYPE_TEXT',3); define('HDOM_TYPE_ENDTAG', 4); define('HDOM_TYPE_ROOT',5); define('HDOM_TYPE_UNKNOWN', 6); define('HDOM_QUOTE_DOUBLE', 0); define('HDOM_QUOTE_SINGLE', 1); define('HDOM_QUOTE_NO', 3); define('HDOM_INFO_BEGIN', 0); define('HDOM_INFO_END', 1); define('HDOM_INFO_QUOTE', 2); define('HDOM_INFO_SPACE', 3); define('HDOM_INFO_TEXT',4); define('HDOM_INFO_INNER', 5); define('HDOM_INFO_OUTER', 6); define('HDOM_INFO_ENDSPACE',7); // helper functions // - // get html dom from file function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } // get html dom from string function str_get_html($str, $lowercase=true) { $dom = new simple_html_dom; $dom->load($str, $lowercase); return $dom; } // dump html dom tree function dump_html_tree($node, $show_attr=true, $deep=0) { $lead = str_repeat('', $deep); echo $lead.$node->tag; if ($show_attr && count($node->attr)>0) { echo '('; foreach($node->attr as $k=>$v) echo "[$k]=>\"".$node->$k.'", '; echo ')'; } echo "\n"; foreach($node->nodes as $c) dump_html_tree($c, $show_attr, $deep+1); } // get dom form file (deprecated) function file_get_dom() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } // get dom form string (deprecated) function str_get_dom($str, $lowercase=true) { $dom = new simple_html_dom; $dom->load($str, $lowercase); return $dom; }
Re: RES: RES: RES: [PHP] CURL error help
On 5/8/09 10:55 AM, "Jônatas Zechim" wrote: Ok, but u need to confirm the $args vars are being passed to that funtion, because I thing they're blanks. Zechim zechim.com São Paulo/Brazil here is the code from the dom.php file, as it stands currently my error reads: Warning: file_get_contents($target_url) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on line 39 Here is the code from dom.php: define('HDOM_TYPE_ELEMENT', 1); define('HDOM_TYPE_COMMENT', 2); define('HDOM_TYPE_TEXT',3); define('HDOM_TYPE_ENDTAG', 4); define('HDOM_TYPE_ROOT',5); define('HDOM_TYPE_UNKNOWN', 6); define('HDOM_QUOTE_DOUBLE', 0); define('HDOM_QUOTE_SINGLE', 1); define('HDOM_QUOTE_NO', 3); define('HDOM_INFO_BEGIN', 0); define('HDOM_INFO_END', 1); define('HDOM_INFO_QUOTE', 2); define('HDOM_INFO_SPACE', 3); define('HDOM_INFO_TEXT',4); define('HDOM_INFO_INNER', 5); define('HDOM_INFO_OUTER', 6); define('HDOM_INFO_ENDSPACE',7); // helper functions // - // get html dom from file function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } // get html dom from string function str_get_html($str, $lowercase=true) { $dom = new simple_html_dom; $dom->load($str, $lowercase); return $dom; } // dump html dom tree function dump_html_tree($node, $show_attr=true, $deep=0) { $lead = str_repeat('', $deep); echo $lead.$node->tag; if ($show_attr && count($node->attr)>0) { echo '('; foreach($node->attr as $k=>$v) echo "[$k]=>\"".$node->$k.'", '; echo ')'; } echo "\n"; foreach($node->nodes as $c) dump_html_tree($c, $show_attr, $deep+1); } // get dom form file (deprecated) function file_get_dom() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } // get dom form string (deprecated) function str_get_dom($str, $lowercase=true) { $dom = new simple_html_dom; $dom->load($str, $lowercase); return $dom; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: RES: RES: [PHP] CURL error help
Ok, but u need to confirm the $args vars are being passed to that funtion, because I thing they're blanks. Zechim zechim.com São Paulo/Brazil -Mensagem original- De: Miller, Terion [mailto:tmil...@springfi.gannett.com] Enviada em: sexta-feira, 8 de maio de 2009 11:52 Para: Jônatas Zechim; Miller, Terion; PHP-General List Assunto: Re: RES: RES: [PHP] CURL error help On 5/8/09 8:49 AM, "Jônatas Zechim" wrote: Try to echo the $target_url var. What's on it? Try to echo the $args var. What's on it? How do you pass the $args? I echo'd the $target_url and I got all the correct urls -did I mention this error reports one time for every url in the array, I am not sure if I should echo the $args on the dom.php page or on my page, I didn't write the dom.php script, it's a bit beyond my skill level. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: RES: [PHP] CURL error help
On 5/8/09 8:49 AM, "Jônatas Zechim" wrote: Try to echo the $target_url var. What's on it? Try to echo the $args var. What's on it? How do you pass the $args? I echo'd the $target_url and I got all the correct urls -did I mention this error reports one time for every url in the array, I am not sure if I should echo the $args on the dom.php page or on my page, I didn't write the dom.php script, it's a bit beyond my skill level. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] CURL error help
Miller, Terion wrote: > > > On 5/8/09 8:04 AM, "Jônatas Zechim" wrote: > > Try to change this: > > curl_setopt($ch,CURLOPT_URL,$targets); > > to: > > curl_setopt($ch,CURLOPT_URL, $target_url); > > Zechim > zechim.com > São Paulo/Brazil > > Thanks for the suggestion: > Tried it and get this error now: > > Warning: file_get_contents($target_url) [function.file-get-contents]: failed > to open stream: No such file or directory in > /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on > line 39 > > On line #39 from my dom.php file is this : > // get html dom form file > function file_get_html() { >$dom = new simple_html_dom; >$args = func_get_args(); >$dom->load(call_user_func_array('file_get_contents', $args), true); >return $dom; > } > > I think somehow the array is not being read or it's trying to pass the full > array of url's as one url? Therefore saying it does not exist? My best guess, > am I making the array wrong? > > Look at your function call in your original post: $html = file_get_html('$target_url'); $target_url is single quoted why? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: RES: [PHP] CURL error help
Try to echo the $target_url var. What's on it? Try to echo the $args var. What's on it? How do you pass the $args? Zechim zechim.com São Paulo/Brazil -Mensagem original- De: Miller, Terion [mailto:tmil...@springfi.gannett.com] Enviada em: sexta-feira, 8 de maio de 2009 10:27 Para: Jônatas Zechim; Miller, Terion; PHP-General List Assunto: Re: RES: [PHP] CURL error help On 5/8/09 8:04 AM, "Jônatas Zechim" wrote: Try to change this: curl_setopt($ch,CURLOPT_URL,$targets); to: curl_setopt($ch,CURLOPT_URL, $target_url); Zechim zechim.com São Paulo/Brazil Thanks for the suggestion: Tried it and get this error now: Warning: file_get_contents($target_url) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on line 39 On line #39 from my dom.php file is this : // get html dom form file function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } I think somehow the array is not being read or it's trying to pass the full array of url's as one url? Therefore saying it does not exist? My best guess, am I making the array wrong?
Re: RES: [PHP] CURL error help
On 5/8/09 8:04 AM, "Jônatas Zechim" wrote: Try to change this: curl_setopt($ch,CURLOPT_URL,$targets); to: curl_setopt($ch,CURLOPT_URL, $target_url); Zechim zechim.com São Paulo/Brazil Thanks for the suggestion: Tried it and get this error now: Warning: file_get_contents($target_url) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/inc/dom.php on line 39 On line #39 from my dom.php file is this : // get html dom form file function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } I think somehow the array is not being read or it's trying to pass the full array of url's as one url? Therefore saying it does not exist? My best guess, am I making the array wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] CURL error help
Try to change this: curl_setopt($ch,CURLOPT_URL,$targets); to: curl_setopt($ch,CURLOPT_URL, $target_url); Zechim zechim.com São Paulo/Brazil -Mensagem original- De: Miller, Terion [mailto:tmil...@springfi.gannett.com] Enviada em: sexta-feira, 8 de maio de 2009 09:50 Para: PHP-General List Assunto: [PHP] CURL error help Trying to run a script on several different pages within the same site by making the url's an array...anyone see a better way to do this? Trying to resolve some curl errors and need some help, here are the errors: Notice: Array to string conversion in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.p hp on line 34 Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Warrants/loopScrape1.p hp on line 36 cURL error number:6 cURL error:Couldn't resolve host 'Array' And here is the code: 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";; foreach ($targets as $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,$targets); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 300); $html = curl_exec($ch); if (!$html) { echo "cURL error number:" .curl_errno($ch); echo "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) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php