Search Results

Search found 5 results on 1 pages for 'tunpishuang'.

Page 1/1 | 1 

  • php -i | find "extension_dir" don't take effect after modified its value

    - by tunpishuang
    i wanna using curl in php script and run it in command line mode. here is the script <?php //enable_dl("php_curl.dll"); $ch = curl_init(); $options=array( CURLOPT_URL=>"http://test.com/wp-content/themes/bluefocus/images/desc_img.jpg", CURLOPT_BINARYTRANSFER=>true, CURLOPT_VERBOSE=>true ); curl_setopt_array($ch,$options); $data = curl_exec($ch); $fp=fopen("test.jpg","w"); fwrite($fp,$data); curl_close($ch); ?> i run it in cmd with command php -i test.php the error message: D:\project>php get.php Fatal error: Call to undefined function curl_init() in D:\project\gals_curl_batch_download\get.php on line 3 phpinfo() in the webpage output shows curl has been enabled cURL support enabled cURL Information libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3 and here is the strange thing phpinfo() int the webpage output show, infact extension enabled in php.ini can be run in web page. the exact directory of the extension is under ./ext extension_dir ./ext ./ext but php -i | find "extension_dir" always show this and can't be modified with in php.ini file extension_dir => C:\php5 => C:\php5 restarted apache serveral times, keeps the same error. so i wonder why the value of extension_dir can't be modified. thx in advance.

    Read the article

  • using php's libcurl to register user and upload file to server

    - by tunpishuang
    here is a site http://www.lyrkjsw.gov.cn that can let the registered user to upload file (e.g. images or office files) to the site. i want to register user and upload image to this site using libcurl binding with php. only registered user can upload image. so i use cookiejar stored in c:\cookie.txt after register and use c:\cookie.txt in uploadImg() function . register user is valid but failed to upload image , can anybody know is there any mistake of my code: <? /* options */ //the list url $expUrl='http://www.lyrkjsw.gov.cn/hbcms/user/list_resource.php'; //the user info to be registered $regUser='jiong'; $regPass='jiong'; $regMail='[email protected]'; $regUrl=str_replace('list_resource.php','register.php',$expUrl); // options for image upload $fileDir='@D:\img\b.jpg'; $fileTitle='aaaaaaaaaaaaa'; $fileDesc='aaaaaaaaaaaaadesc'; $uploadImgUrl=str_replace('list_resource.php','add_resource.php',$expUrl); /* register function */ function reg($regurl,$u,$p,$m) { $ch = curl_init(); $options=array( CURLOPT_URL=>$regurl, CURLOPT_RETURNTRANSFER=>true, CURLOPT_POST=>true, CURLOPT_POSTFIELDS=>'mod=register_now&next_url=index.php&addon_app=&referrer_id=&login_name='.$u.'&login_pass='.$p.'&confirm_login_pass='.$p.'&login_email='.$m.'&nickname=&gender=0&qq=&mobile=&telephone=&true_name=&website_name=&website_url=&my_question=&my_answer=', CURLOPT_COOKIESESSION=>true, CURLOPT_HEADER=>true, CURLOPT_COOKIEJAR=>'c:\cookie.txt' ); curl_setopt_array($ch,$options); $data = curl_exec($ch); if(strpos($data,'??')){ printf("register ok :)\n"); curl_close($ch); return true; }else{ printf("register failed:(\n"); curl_close($ch); return false; } } /* image uploading function */ function uploadImg($uploadimgurl,$filedir,$filetitle,$filedesc) { $ch = curl_init(); $options=array( CURLOPT_COOKIEFILE=>'c:\cookie.txt', CURLOPT_URL=>$uploadimgurl, CURLOPT_RETURNTRANSFER=>1, CURLOPT_POST=>1, CURLOPT_POSTFIELDS=>" 'MAX_FILE_SIZE'='33554432'& 'preview_area_id'='upload_file'& 'editor_area_id'='body'& 'js_function'=''& 'resource_id'=''& 'show_top_part'='no'& 'file_1'=$filedir& 'file_title_1'=$filetitle& 'file_desc_1'=$filedesc " ); curl_setopt_array($ch,$options); $data = curl_exec($ch); if(strpos($data,'??')){ printf("upload ok :)\n"); }else{ printf("upload failed :(\n"); } curl_close($ch); } if(reg($regUrl,$regUser,$regPass,$regMail) != false) { uploadImg($uploadImgUrl,$fileDir,$fileTitle,$fileDesc); } http://www.lyrkjsw.gov.cn/hbcms/user/list_resource.php (list file page) http://www.lyrkjsw.gov.cn/hbcms/user/register.php (register page) http://www.lyrkjsw.gov.cn/hbcms/user/add_resource.php (image uploading page)

    Read the article

  • How to write a function to output unconstant loop

    - by tunpishuang
    Here is the function description test($argv) $argv is an array, for example $argv=array($from1,$to1,$from2,$to2.....); array items must be even. $argv=array(1,2,4,5) : this will output values like below: 1_4 1_5 2_4 2_5 The number of array $argv's is not constant. Maybe 3 or 4 levels of loop will be outputed. I know this will used RECURSIVE , but i don't know exactly how to code.

    Read the article

  • how to write a function to output unconstant loop with PHP

    - by tunpishuang
    here is the function description test($argv) $argv is an array , for example $argv=array($from1,$to1,$from2,$to2.....); array items must be even. $argv=array(1,2,4,5) : this will output values like below: 1_4 1_5 2_4 2_5 the number of arrray $argv's is not constant. maybe 3 or 4 levels of loop will be outputed. i know this will used RECURSIVE , but i don't know exatly how to code.

    Read the article

  • strange array in php

    - by tunpishuang
    here i wrote a function , it's general purpose is to get an array of the depIds under the parent root $depId. i use recursion method to get the array. public function getEmpsByDep($depId){ $query = "select * from ".SQLPREFIX."department where id_parent=".$depId; $stmt=$this->db->query($query); while(($row=$this->db->fetch_assoc($stmt))==true) { if($this->hasChildNode($row['DEPID'])) { $depId = $row['DEPID']; self::getEmpsByDep($depId); } else { $arr[]=$row['DEPID']; } } return ($arr); } while i think it should return a 1D array of the depid.but it return a strange 2D array like this: array(4) { [0]=> string(2) "11" [1]=> string(2) "12" [2]=> string(2) "13" [3]=> string(2) "14" } array(3) { [0]=> string(2) "19" [1]=> string(2) "20" [2]=> string(2) "21" } array(3) { [0]=> string(2) "15" [1]=> string(2) "16" [2]=> string(2) "17" } array(8) { [0]=> string(1) "2" [1]=> string(1) "4" [2]=> string(1) "5" [3]=> string(1) "6" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "9" [7]=> string(2) "10" } here is the table structure and data sample: $query[]="create table ".$sqltblpre."department( depId number(10) not null primary key, depName varchar2(50) not null, id_parent number(10) )"; //department(?????) $index=1; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',0)"; //1 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //2 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //3 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //4 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //5 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //6 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'?????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',3)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',3)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',3)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',3)"; //18 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',18)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',18)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',18)"; so in a word, how can i get the 1D array thought the right code of this function?

    Read the article

1