[PHP Programmer Needed] Fixing Curl issue and regex issue

Discussion in 'Programming' started by linkinpark2014, Jan 28, 2009.

  1. #1
    hi,
    I need PHP programmer that can do or just fix my codes..

    - the first issue is Posting with CURL..the thing that i need to post in CURL is 1 js button and 2 text boxes..

    - second issue is 2 use regex (preg_match_all or any similar function) with arabic letters to search specific word I want in webpage..


    I will give up 5$ for each task..
    payments only on paypal..

    pm me so i can send the details
    regards,
     
    linkinpark2014, Jan 28, 2009 IP
  2. daman371

    daman371 Peon

    Messages:
    121
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    I could take a look at it for you.
     
    daman371, Jan 28, 2009 IP
  3. harrisunderwork

    harrisunderwork Well-Known Member

    Messages:
    1,005
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    135
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Hello, I am expert in PHP and especially curl. Please check my past itrader and looking forward for the details. Thanks :)
     
    harrisunderwork, Jan 28, 2009 IP
  4. linkinpark2014

    linkinpark2014 Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    here is the source code for curl, i have included the details inside the source...

    the website is using windows-1256, however when curl grabs the content..it treats the data as utf-8..originally its windows-1256
    so what i want is to convert the utf-8 back to windows-1256

    here is the source:
    
    <?php
    #I'm using curl library to grab the content of an arabic website.. but when i echo the data of that website..i get all characters in ????? format.
    #after i checked the website encoding i found that the website is using windows-1256 encoding (arabic)..
    #so when curl grabs the content it converts the data to unknown characters automatically.. so when I print the data i get all characters in ???????? format..
    #but if i change browser encoding i can get the correct format.. 
    
    $url2="http://forum.kooora.com/f.aspx?mode=f&f=169";
    //now show me my post
    
    
    function get_content($url)  
    { 
    $ch = curl_init();  
    
    curl_setopt ($ch, CURLOPT_URL, $url);  
    curl_setopt ($ch, CURLOPT_HEADER, 1); 
    
    $str  = "Accept-Language: en-us,en;q=0.5\r\n";
    $str .= "Accept-Charset: windows-1256;q=0.7,*;q=0.7\r\n";
    $str .= "Keep-Alive: 300\r\n";
    $str .= "Connection: keep-alive\r\n";
           
    curl_setopt($ch, CURLOPT_HTTPHEADER, array($str));
    
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');  
    curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); //saved cookies
    ob_start();  
      
    curl_exec ($ch);  
    curl_close ($ch);  
    $string = ob_get_contents();  
    
    ob_end_clean();  
    
    return $string;      
    }
    
    
    $content = get_content("$url2");  
    $pattern='/"ftnh",(.*?),(.*?)(روابط)(.*?),/'; //this pattern will get all words near "روابط"  <====== here "روابط " already in utf-8 format 
    											  //but when i use preg_match_all function to match this word with the words on the website i get unmatched result, 
    											  //when i browse manually i absoluty can read many words similar to this 1
    
    if(preg_match_all($pattern,$content,$out,PREG_PATTERN_ORDER))
    {
    echo "matched";
    print_r($out);
    }
    
    else
    {
    echo "no match";
    }
    
    
    
    ?>
    
    PHP:
     
    linkinpark2014, Jan 28, 2009 IP