Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-11-19 13:51:42
Point:500 Replies:19 POST_ID:828536USER_ID:11059
Topic:
Visual Basic Programming;;PHP Scripting Language
I get one remote website to be grabbed by php 's curl function but its url full path name is really
long and has a lot of "-", "_" character inside the url. I try to directly click the website URL below
in Firefox that is no problem at . But when I use curl function and loadHTML() and savHTML() in php to
grab the html page of the remate site like running www.mysite.com/longURLphp in FIrefox that is always
no any html code output in my FIrefox. Why ?
Is it related to URLencode and decode issue for query string in URL I need to do before using curl function
in php ?
URL name:
http://adclick.g.doubleclick.net/aclk?sa=L&ai=BhnUzthvITtfSOOeLiAfHr_j-D8-Uw4gCAAAAEAEg5-j6ATgAWK_u84MgYNkCsgERd3d3LmUtaGZ0cmFkZS5jb226AQlnZnBfaW1hZ2XIAQnaAVxodHRwOi8vd3d3LmUtaGZ0cmFkZS5jb20vZGF0YS9waHAvbGlua3JlZi5waHA_bG9hZD1odHRwOi8vd3d3Lnczc2Nob29scy5jb20vaHRtbC9kZWZhdWx0LmFzcOABA5gC3hSpAuIEHKTlE4c-wAIC4AIA6gIHU21hbGxQU_gC8tEekAOwCZgDjAaoAwHgBAGgBhY&num=0&sig=AOD64_3XBunQzbdIaLk8S-a8OQtwrl2NYQ&client=ca-pub-3440800076797949&adurl=http://www.wix.com/start/matrix?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.com500
And my php program, longURL.php is working for most remote webiste beside this special URL path
COuld you try this program of php and try to go the website directly to get more know of my question.
Please advise
Duncan
long and has a lot of "-", "_" character inside the url. I try to directly click the website URL below
in Firefox that is no problem at . But when I use curl function and loadHTML() and savHTML() in php to
grab the html page of the remate site like running www.mysite.com/longURLphp in FIrefox that is always
no any html code output in my FIrefox. Why ?
Is it related to URLencode and decode issue for query string in URL I need to do before using curl function
in php ?
URL name:
http://adclick.g.doubleclick.net/aclk?sa=L&ai=BhnUzthvITtfSOOeLiAfHr_j-D8-Uw4gCAAAAEAEg5-j6ATgAWK_u84MgYNkCsgERd3d3LmUtaGZ0cmFkZS5jb226AQlnZnBfaW1hZ2XIAQnaAVxodHRwOi8vd3d3LmUtaGZ0cmFkZS5jb20vZGF0YS9waHAvbGlua3JlZi5waHA_bG9hZD1odHRwOi8vd3d3Lnczc2Nob29scy5jb20vaHRtbC9kZWZhdWx0LmFzcOABA5gC3hSpAuIEHKTlE4c-wAIC4AIA6gIHU21hbGxQU_gC8tEekAOwCZgDjAaoAwHgBAGgBhY&num=0&sig=AOD64_3XBunQzbdIaLk8S-a8OQtwrl2NYQ&client=ca-pub-3440800076797949&adurl=http://www.wix.com/start/matrix?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.com500
And my php program, longURL.php is working for most remote webiste beside this special URL path
COuld you try this program of php and try to go the website directly to get more know of my question.
Please advise
Duncan
<?php$url="http://adclick.g.doubleclick.net/aclk?sa=L&ai=BhnUzthvITtfSOOeLiAfHr_j-D8-Uw4gCAAAAEAEg5-j6ATgAWK_u84MgYNkCsgERd3d3LmUtaGZ0cmFkZS5jb226AQlnZnBfaW1hZ2XIAQnaAVxodHRwOi8vd3d3LmUtaGZ0cmFkZS5jb20vZGF0YS9waHAvbGlua3JlZi5waHA_bG9hZD1odHRwOi8vd3d3Lnczc2Nob29scy5jb20vaHRtbC9kZWZhdWx0LmFzcOABA5gC3hSpAuIEHKTlE4c-wAIC4AIA6gIHU21hbGxQU_gC8tEekAOwCZgDjAaoAwHgBAGgBhY&num=0&sig=AOD64_3XBunQzbdIaLk8S-a8OQtwrl2NYQ&client=ca-pub-3440800076797949&adurl=http://www.wix.com/start/matrix?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.com500";$file_url=my_curl($url,"" , 7, TRUE,2,"");$dom = new DOMDocument();@$dom->loadHTML($file_url);$temp=$dom->saveHTML();echo $temp;//////////////////////////////curl function ///////////////////////function my_curl( $url, $get_array=array(), $timeout=3, $error_report=TRUE, $minsize=1,$fd){ if (!empty($get_string)) $url .= '?' . $get_string; $curl = curl_init(); // HEADERS AND OPTIONS APPEAR TO BE A FIREFOX BROWSER REFERRED BY GOOGLE $header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection: keep-alive"; $header[] = "Keep-Alive: 300"; $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "Accept-Language: en-us,en;q=0.5"; $header[] = "Pragma: "; // BROWSERS USUALLY LEAVE BLANK // SET THE CURL OPTIONS - SEE http://php.net/manual/en/function.curl-setopt.php curl_setopt( $curl, CURLOPT_URL, $url ); curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6' ); curl_setopt( $curl, CURLOPT_HTTPHEADER, $header ); curl_setopt( $curl, CURLOPT_REFERER, 'http://www.google.com' ); curl_setopt( $curl, CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $curl, CURLOPT_AUTOREFERER, TRUE );if ($minsize==1) { curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt($curl, CURLOPT_RANGE,"0-250000");} elseif ($minsize==0) { curl_setopt($curl, CURLOPT_FILE, $fd); } elseif ($minsize==2) { curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); }elseif ($minsize==3) { curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt($curl, CURLOPT_RANGE,"100000-1100000");}elseif ($minsize==4) { curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt($curl, CURLOPT_RANGE,$fd);}if ($minsize==1) { curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt($curl, CURLOPT_RANGE,"0-250000");} curl_setopt( $curl, CURLOPT_TIMEOUT, $timeout ); // RUN THE CURL REQUEST AND GET THE RESULTS $htm = curl_exec($curl); // ON FAILURE HANDLE ERROR MESSAGE //global $track; // declaring global variable if ($htm === FALSE) { if ($error_report) { $err = curl_errno($curl); $inf = curl_getinfo($curl); echo "FAILC: $url TIMEOUT=$timeout, CURL_ERRNOC=$err"; // echo "FAILC: $url"; // echo "memory usage_curl=".memory_get_usage(). ""; // 57960 // var_dump($inf); } curl_close($curl); return FALSE; } // ON SUCCESS RETURN XML / HTML STRING curl_close($curl); return $htm;}?> 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:44:45:46:47:48:49:50:51:52:53:54:55:56:57:58:59:60:61:62:63:64:65:66:67:68:69:70:71:72:73:74:75:76:77:78:79:80:81:82:83:84:85:86:87:88:89:90:91:92:93:94:95:96:97:98:99:
Author: duncanb7 replied at 2024-11-20 09:44:59
Summary to this thread:
The root cause is NOT by the max len of URL and actully it is related to curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE ) which is not allowed by share-server hosting company if the URL
link do a lot location redirection and give you warning CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
And probably the hosting company won't unset open_basedir for you users for security concern.
Solution to this problem without asking help from hosting company, I found a userful link which solved the
issue completely with curl() function for site redirection URL link .
In following code, you need to replace & by &&, and replace > by >
and replace list($header, $data) = explode(" ", $data, 2);(Linux-version) by list($header, $data) = explode(" ", $data, 2); for Window version
And the URL page result string will be coming to your browser and now you modifiy anything on the result
string for setting CSS and detect tis body heigh and width for reszie window in IFRAME
Thanks for all of you to trigger the final soluation
Duncan
http://www.edmondscommerce.co.uk/curl/php-curl-curlopt_followlocation-and-open_basedir-or-safe-mode/
The root cause is NOT by the max len of URL and actully it is related to curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE ) which is not allowed by share-server hosting company if the URL
link do a lot location redirection and give you warning CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
And probably the hosting company won't unset open_basedir for you users for security concern.
Solution to this problem without asking help from hosting company, I found a userful link which solved the
issue completely with curl() function for site redirection URL link .
In following code, you need to replace & by &&, and replace > by >
and replace list($header, $data) = explode(" ", $data, 2);(Linux-version) by list($header, $data) = explode(" ", $data, 2); for Window version
And the URL page result string will be coming to your browser and now you modifiy anything on the result
string for setting CSS and detect tis body heigh and width for reszie window in IFRAME
Thanks for all of you to trigger the final soluation
Duncan
http://www.edmondscommerce.co.uk/curl/php-curl-curlopt_followlocation-and-open_basedir-or-safe-mode/
function curl($url){$go = curl_init($url);curl_setopt ($go, CURLOPT_URL, $url);//follow on location problemsif (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')){curl_setopt ($go, CURLOPT_FOLLOWLOCATION, $l);$syn = curl_exec($go);}else{$syn = curl_redir_exec($go);}curl_close($go);return $syn;}//follow on location problems workaroundfunction curl_redir_exec($ch){static $curl_loops = 0;static $curl_max_loops = 20;if ($curl_loops++>= $curl_max_loops){$curl_loops = 0;return FALSE;}curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$data = curl_exec($ch);list($header, $data) = explode("", $data, 2);$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);if ($http_code == 301 || $http_code == 302){$matches = array();preg_match('/Location:(.*?)/', $header, $matches);$url = @parse_url(trim(array_pop($matches)));if (!$url){//couldn't process the url to redirect to$curl_loops = 0;return $data;}$last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));if (!$url['scheme'])$url['scheme'] = $last_url['scheme'];if (!$url['host'])$url['host'] = $last_url['host'];if (!$url['path'])$url['path'] = $last_url['path'];$new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query']?'?'.$url['query']:'');curl_setopt($ch, CURLOPT_URL, $new_url);return curl_redir_exec($ch);} else {$curl_loops=0;return $data;}} 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:44:45:46:47:48:49:50:51:52:53:54:55:56:57:58:59:60:61:62:63:64:65:66:67:68:69:70:71:72:73:74:75:76:77:78:79:80:81:82:83:84:85:86:87:88:89:90:91:92:93:94:95:96:97:98:99:100:101:102:
Author: duncanb7 replied at 2024-11-20 09:43:17
replace && by &&
Assisted Solution
Author: duncanb7 replied at 2024-11-20 09:42:21
Summary to this thread:
The root cause is NOT by the max len of URL and actully it is related to curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE ) which is not allowed by share-server hosting company if the URL
link do a lot location redirection and give you warning CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
And probably the hosting company won't unset open_basedir for you users for security concern.
Solution to this problem without asking help from hosting company, I found a userful link which solved the
issue completely with curl() function for site redirection URL link .
In following code, you need to replace & by &&, and replace > by >
and replace list($header, $data) = explode(" ", $data, 2);(Linux-version) by list($header, $data) = explode(" ", $data, 2); for Window version
And the URL page result string will be coming to your browser and now you modifiy anything on the result
string for setting CSS and detect tis body heigh and width for reszie window in IFRAME
Thanks for all of you to trigger the final soluation
Duncan
http://www.edmondscommerce.co.uk/curl/php-curl-curlopt_followlocation-and-open_basedir-or-safe-mode/
The root cause is NOT by the max len of URL and actully it is related to curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE ) which is not allowed by share-server hosting company if the URL
link do a lot location redirection and give you warning CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
And probably the hosting company won't unset open_basedir for you users for security concern.
Solution to this problem without asking help from hosting company, I found a userful link which solved the
issue completely with curl() function for site redirection URL link .
In following code, you need to replace & by &&, and replace > by >
and replace list($header, $data) = explode(" ", $data, 2);(Linux-version) by list($header, $data) = explode(" ", $data, 2); for Window version
And the URL page result string will be coming to your browser and now you modifiy anything on the result
string for setting CSS and detect tis body heigh and width for reszie window in IFRAME
Thanks for all of you to trigger the final soluation
Duncan
http://www.edmondscommerce.co.uk/curl/php-curl-curlopt_followlocation-and-open_basedir-or-safe-mode/
function curl($url){$go = curl_init($url);curl_setopt ($go, CURLOPT_URL, $url);//follow on location problemsif (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')){curl_setopt ($go, CURLOPT_FOLLOWLOCATION, $l);$syn = curl_exec($go);}else{$syn = curl_redir_exec($go);}curl_close($go);return $syn;}//follow on location problems workaroundfunction curl_redir_exec($ch){static $curl_loops = 0;static $curl_max_loops = 20;if ($curl_loops++>= $curl_max_loops){$curl_loops = 0;return FALSE;}curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$data = curl_exec($ch);list($header, $data) = explode("", $data, 2);$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);if ($http_code == 301 || $http_code == 302){$matches = array();preg_match('/Location:(.*?)/', $header, $matches);$url = @parse_url(trim(array_pop($matches)));if (!$url){//couldn't process the url to redirect to$curl_loops = 0;return $data;}$last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));if (!$url['scheme'])$url['scheme'] = $last_url['scheme'];if (!$url['host'])$url['host'] = $last_url['host'];if (!$url['path'])$url['path'] = $last_url['path'];$new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query']?'?'.$url['query']:'');curl_setopt($ch, CURLOPT_URL, $new_url);return curl_redir_exec($ch);} else {$curl_loops=0;return $data;}} 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:44:45:46:47:48:49:50:51:52:53:54:55:56:57:58:59:60:61:62:63:64:65:66:67:68:69:70:71:72:73:74:75:76:77:78:79:80:81:82:83:84:85:86:87:88:89:90:91:92:93:94:95:96:97:98:99:100:101:102:
Author: duncanb7 replied at 2024-11-19 15:59:45
I am talking about not at Linux shell but on browser with your server, please confrim
Author: duncanb7 replied at 2024-11-19 15:57:59
THis hosting24.com is not good at all a lot of restriction.
So I am planning to switch , thanks for your recommandation for ChiHost.com
But problem hosting sometimes is also good, at least let us increase solving internet problem ability
and technical knowledge.
So I will prefer to keep to solving this problem till final at this hosting24.com first before swtiching
THanks Ray, if interesting, give me instruction to finalize this
One more question, your curl code running in your server on FIrefox or IE that is no any problem
at such long URL path, Is it right ?
Please confirm again
Duncan
So I am planning to switch , thanks for your recommandation for ChiHost.com
But problem hosting sometimes is also good, at least let us increase solving internet problem ability
and technical knowledge.
So I will prefer to keep to solving this problem till final at this hosting24.com first before swtiching
THanks Ray, if interesting, give me instruction to finalize this
One more question, your curl code running in your server on FIrefox or IE that is no any problem
at such long URL path, Is it right ?
Please confirm again
Duncan
Author: duncanb7 replied at 2024-11-19 15:52:38
Safe mode is already off if echo phpinfo(); in php pragram for my php setting
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen On On
allow_url_include On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file /usr/lib/php/head.php /usr/lib/php/head.php
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
detect_unicode On On
disable_classes no value no value
disable_functions symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl Off Off
error_append_string no value no value
error_log error_log error_log
error_prepend_string no value no value
error_reporting 6135 6135
expose_php On On
extension_dir /usr/local/lib/php/extensions/no-debug-non-zts-20060613 /usr/local/lib/php/extensions/no-debug-non-zts-20060613
file_uploads On On
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors On On
ignore_repeated_source On On
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/lib/php:/usr/local/lib/php .:/usr/lib/php:/usr/local/lib/php
log_errors On On
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
mail.force_extra_parameters no value no value
max_execution_time 300 30
max_file_uploads 20 20
max_input_nesting_level 64 64
max_input_time 60 60
memory_limit 128M 128M
open_basedir /home/phptutorial:/usr/lib/php:/usr/local/lib/php:/tmp no value
output_buffering 1 1
output_handler no value no value
post_max_size 128M 128M
precision 12 12
realpath_cache_size 16K 16K
realpath_cache_ttl 120 120
register_argc_argv Off Off
register_globals Off Off
register_long_arrays On On
report_memleaks On On
report_zend_debug On On
safe_mode Off Off
safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 128M 128M
upload_tmp_dir /tmp /tmp
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
zend.ze1_compatibility_mode Off Off
I guess there is other root cause for that which might be related to the long URL path will do
many times of site redirection before get the final remote site. Is it related to number of
redirection in php at browser not on Linux shell ?
Please advise
Duncan
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen On On
allow_url_include On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file /usr/lib/php/head.php /usr/lib/php/head.php
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
detect_unicode On On
disable_classes no value no value
disable_functions symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl Off Off
error_append_string no value no value
error_log error_log error_log
error_prepend_string no value no value
error_reporting 6135 6135
expose_php On On
extension_dir /usr/local/lib/php/extensions/no-debug-non-zts-20060613 /usr/local/lib/php/extensions/no-debug-non-zts-20060613
file_uploads On On
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors On On
ignore_repeated_source On On
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/lib/php:/usr/local/lib/php .:/usr/lib/php:/usr/local/lib/php
log_errors On On
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
mail.force_extra_parameters no value no value
max_execution_time 300 30
max_file_uploads 20 20
max_input_nesting_level 64 64
max_input_time 60 60
memory_limit 128M 128M
open_basedir /home/phptutorial:/usr/lib/php:/usr/local/lib/php:/tmp no value
output_buffering 1 1
output_handler no value no value
post_max_size 128M 128M
precision 12 12
realpath_cache_size 16K 16K
realpath_cache_ttl 120 120
register_argc_argv Off Off
register_globals Off Off
register_long_arrays On On
report_memleaks On On
report_zend_debug On On
safe_mode Off Off
safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 128M 128M
upload_tmp_dir /tmp /tmp
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
zend.ze1_compatibility_mode Off Off
I guess there is other root cause for that which might be related to the long URL path will do
many times of site redirection before get the final remote site. Is it related to number of
redirection in php at browser not on Linux shell ?
Please advise
Duncan
Assisted Solution
Expert: Ray Paseur replied at 2024-11-19 15:10:21
166 points EXCELLENT
Yeah, I get it. Please contact your host and tell them that you need them to remove "safe mode" from your account.
If they cannot do that at once, move to a new hosting company. I use and recommend ChiHost.com and while there are others with good results at BlueHost, DreamHost and LiquidWeb, my experience with ChiHost has been excellent. They understand the work of web hosting and if you call them with a problem (I have had only a very few in several years) they have the answers, and they have people in the computer center that care about your issues and want to find solutions.
In case you call them, ask for Nick Gilbert and tell him I send my regards. He has been a dependable colleague in thick and thin.
All the best, ~Ray
If they cannot do that at once, move to a new hosting company. I use and recommend ChiHost.com and while there are others with good results at BlueHost, DreamHost and LiquidWeb, my experience with ChiHost has been excellent. They understand the work of web hosting and if you call them with a problem (I have had only a very few in several years) they have the answers, and they have people in the computer center that care about your issues and want to find solutions.
In case you call them, ask for Nick Gilbert and tell him I send my regards. He has been a dependable colleague in thick and thin.
All the best, ~Ray
Author: duncanb7 replied at 2024-11-19 14:57:09
http://www.web-development-blog.com/archives/curl-follow-url-location-while-open_basedir-is-set/ from google search
Some people get my same problem at the warning in browers
Some people get my same problem at the warning in browers
Author: duncanb7 replied at 2024-11-19 14:49:34
There is no setting for max len of URL path name in php system setting
So I guess that is casued by curlopt() setting
http://php.benscom.com/manual/en/function.curl-setopt.php
So I guess that is casued by curlopt() setting
http://php.benscom.com/manual/en/function.curl-setopt.php
Author: duncanb7 replied at 2024-11-19 14:36:34
I might be change php setting for maxlen of URL at Linux shell
Author: duncanb7 replied at 2024-11-19 14:32:51
Expert: Ray Paseur replied at 2024-11-19 14:29:36
Who is your hosting company?
Author: duncanb7 replied at 2024-11-19 14:27:37
Both method of file_get_content and curl from your code is working at my Linux Shell but
not in browser
it might be caused by that my php setting from my share-server hosting to limit I run the long URL pathname
in browser. What parameter in php info in my server I can check this out ?
Please advise
DUncan
not in browser
it might be caused by that my php setting from my share-server hosting to limit I run the long URL pathname
in browser. What parameter in php info in my server I can check this out ?
Please advise
DUncan
Author: duncanb7 replied at 2024-11-19 14:19:30
I mean it works at Linux shell but not in broswer
Author: duncanb7 replied at 2024-11-19 14:18:25
The warning is out when I run in Firefox
But I run it in Linux shell at my server, output is okay wihtout any warning
Do you try your code in FIrefox ?
Please advise
DUncan
But I run it in Linux shell at my server, output is okay wihtout any warning
Do you try your code in FIrefox ?
Please advise
DUncan
Author: duncanb7 replied at 2024-11-19 14:13:56
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in curlee.php on line 42
I get these error from your code , what you change from mine
Please advise
Duncan
I get these error from your code , what you change from mine
Please advise
Duncan
Assisted Solution
Expert: Ray Paseur replied at 2024-11-19 14:09:38
167 points EXCELLENT
Sure. Try this one.
<?php // RAY_temp_duncanb7.phperror_reporting(E_ALL);// FROM THE POST AT EE$url = 'http://adclick.g.doubleclick.net/aclk?sa=L&ai=BhnUzthvITtfSOOeLiAfHr_j-D8-Uw4gCAAAAEAEg5-j6ATgAWK_u84MgYNkCsgERd3d3LmUtaGZ0cmFkZS5jb226AQlnZnBfaW1hZ2XIAQnaAVxodHRwOi8vd3d3LmUtaGZ0cmFkZS5jb20vZGF0YS9waHAvbGlua3JlZi5waHA_bG9hZD1odHRwOi8vd3d3Lnczc2Nob29scy5jb20vaHRtbC9kZWZhdWx0LmFzcOABA5gC3hSpAuIEHKTlE4c-wAIC4AIA6gIHU21hbGxQU_gC8tEekAOwCZgDjAaoAwHgBAGgBhY&num=0&sig=AOD64_3XBunQzbdIaLk8S-a8OQtwrl2NYQ&client=ca-pub-3440800076797949&adurl=http://www.wix.com/start/matrix?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.com500';// READ THE INFORMATION FROM THE REMOTE URL$str = my_curl($url);// SHOW THE WORK PRODUCTecho "<pre>";echo htmlentities($str);// A FUNCTION TO RUN A CURL-GET CLIENT CALL TO A FOREIGN SERVERfunction my_curl( $url, $timeout=3, $error_report=TRUE){ $curl = curl_init(); // HEADERS AND OPTIONS APPEAR TO BE A FIREFOX BROWSER REFERRED BY GOOGLE $header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection: keep-alive"; $header[] = "Keep-Alive: 300"; $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "Accept-Language: en-us,en;q=0.5"; $header[] = "Pragma: "; // BROWSERS USUALLY LEAVE BLANK // SET THE CURL OPTIONS - SEE http://php.net/manual/en/function.curl-setopt.php curl_setopt( $curl, CURLOPT_URL, $url ); curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6' ); curl_setopt( $curl, CURLOPT_HTTPHEADER, $header ); curl_setopt( $curl, CURLOPT_REFERER, 'http://www.google.com' ); curl_setopt( $curl, CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $curl, CURLOPT_AUTOREFERER, TRUE ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE ); curl_setopt( $curl, CURLOPT_TIMEOUT, $timeout ); // RUN THE CURL REQUEST AND GET THE RESULTS $htm = curl_exec($curl); // ON FAILURE HANDLE ERROR MESSAGE if ($htm === FALSE) { if ($error_report) { $err = curl_errno($curl); $inf = curl_getinfo($curl); echo "CURL FAIL: $url TIMEOUT=$timeout, CURL_ERRNO=$err"; var_dump($inf); } curl_close($curl); return FALSE; } // ON SUCCESS RETURN XML / HTML STRING curl_close($curl); return $htm;} 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:44:45:46:47:48:49:50:51:52:53:54:55:56:57:58:59:60:61:62:63:64:65:
Author: duncanb7 replied at 2024-11-19 14:04:46
Thanks for your quick reply, I would like to use curl function instead of file_get_content since later on I can change some variable parameter such as grabbing website timeout ? Do you have
such experience for curl
PLease advise
Duncan
such experience for curl
PLease advise
Duncan
Accepted Solution
Expert: Ray Paseur replied at 2024-11-19 14:02:10
167 points EXCELLENT
Try it here: http://www.laprbass.com/RAY_temp_duncanb7.php
<?php // RAY_temp_kkbenj.phperror_reporting(E_ALL);// FROM THE POST AT EE$url = 'http://adclick.g.doubleclick.net/aclk?sa=L&ai=BhnUzthvITtfSOOeLiAfHr_j-D8-Uw4gCAAAAEAEg5-j6ATgAWK_u84MgYNkCsgERd3d3LmUtaGZ0cmFkZS5jb226AQlnZnBfaW1hZ2XIAQnaAVxodHRwOi8vd3d3LmUtaGZ0cmFkZS5jb20vZGF0YS9waHAvbGlua3JlZi5waHA_bG9hZD1odHRwOi8vd3d3Lnczc2Nob29scy5jb20vaHRtbC9kZWZhdWx0LmFzcOABA5gC3hSpAuIEHKTlE4c-wAIC4AIA6gIHU21hbGxQU_gC8tEekAOwCZgDjAaoAwHgBAGgBhY&num=0&sig=AOD64_3XBunQzbdIaLk8S-a8OQtwrl2NYQ&client=ca-pub-3440800076797949&adurl=http://www.wix.com/start/matrix?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.com500';// TRY$str = file_get_contents($url);echo "<pre>";echo htmlentities($str); 1:2:3:4:5:6:7:8:9:10: