hi get the following output to my curl page as
Array ( [0] => Array ( [news_id] => 126388 [news_title] => رئيس الدولة بخير وعافية وصحته طيبة [news_date] => 2014-11-27 03:17:03 [TAGS] => إماراتنا,الأولى [news_detail] => أكده الأرض يان، طيب الله ثراه، مؤسس وباني هذه الدولة وإخوانه حكام الإمارات الأوائل يرحمهم الله جميعاً. وأعرب سهيل المرر وأفراد أسرته عن شكرهم وامتنانهم لسمو ولي عهد أبوظبي على تلبيته الدعوة وزيارتهم، مرحبين وأفراد الأسرة بهذه الزيارة الكريمة التي تعبر عن عمق الروابط والتواصل بين قيادة دولة الإمارات العربية المتحدة وأبناء الوطن. رافق سموه في الزيارة الفريق سمو الشيخ سيف بن زايد آل نهيان نائب رئيس مجلس الوزراء وزير الداخلية، وعبدالله مهير الكتبي، ومحمد مبارك المزروعي وكيل ديوان ولي العهد. [term_id] => 7 [news_category] => home-news [news_name] => إماراتنا [news_key] => source [news_source] => وام ـ أبوظبي [news_image] => http://test.com//wp-content/uploads/ ) )
and when i post this through curl and get the above array in posted php page i got ??????
as the code as following
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$host="localhost";
$username="root";
$password="";
$db_name="demo";
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select db");
$sSQL= 'SET CHARACTER SET utf8';
mysql_query($sSQL);
$date="2014-11-27";
$query="SELECT wp_posts.ID as Id,wp_posts.post_title as Title,wp_posts.post_date as DATE,wp_postmeta.meta_key,wp_postmeta.meta_value,
GROUP_CONCAT(wp_terms.name) AS TAGS, wp_posts.post_content as CONTENT,wp_terms.term_id,wp_terms.slug,wp_terms.name,wp_posts.post_parent as parent_id FROM wp_terms
INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
INNER JOIN wp_term_relationships ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
INNER JOIN wp_posts ON wp_posts.ID = wp_term_relationships.object_id
INNER JOIN wp_postmeta ON(wp_posts.ID = wp_postmeta.post_id)
WHERE post_type LIKE 'post' AND post_status LIKE 'publish' and meta_key='source' and post_date like '%$date%'
GROUP BY wp_posts.ID order by post_date DESC limit 10";
$query_run= mysql_query($query);
while ($row = mysql_fetch_assoc($query_run)) {
$meta_value_id= "select meta_value from wp_postmeta where meta_key='_thumbnail_id' and post_id='".$row['Id']."'";
$query_run_meta= mysql_query($meta_value_id);
$row1= mysql_fetch_assoc($query_run_meta);
$meta_image= "select meta_value from wp_postmeta where meta_key='_wp_attached_file' and post_id='".$row1['meta_value']."'";
$query_meta= mysql_query($meta_image);
$row2= mysql_fetch_assoc($query_meta);
$detail['news_id']=($row['Id']);
$detail['news_title']=(strip_tags($row['Title']));
$detail['news_date']=(strip_tags($row['DATE']));
$detail['TAGS']=(strip_tags($row['TAGS']));
$detail['news_detail']=(strip_tags($row['CONTENT']));
$detail['term_id']=($row['term_id']);
$detail['news_category']=(strip_tags($row['slug']));
$detail['news_name']=(strip_tags($row['name']));
$detail['news_key']=(strip_tags($row['meta_key']));
$detail['news_source']=(strip_tags($row['meta_value']));
$detail['news_image']=("http://test.com//wp-content/uploads/".$row2['meta_value']);
$details[]=$detail;
}
//for test the data;
print_r($details);
$str=http_build_query($details);
//set POST variables
$url = 'http://localhost/TestProjects/vault/test.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $str);
//execute post
$result = curl_exec($ch);
echo $result;
//close connection
curl_close($ch);
?>
and in the test php page code: print_r($_POST);
AND I GOT AS
Array ( [0] => Array ( [news_id] => 126388 [news_title] => ???? ?????? ???? ?????? ????? ???? [news_date] => 2014-11-27 03:17:03 [TAGS] => ????????,?????? [news_detail] => ??? ?????? ??? ??? ????? ???? ?? ???? ?? ????? ??? ??? ?????? ???? ?????? ?????? ?????? ???????? ?? ?? ??????? ????? ??????? ????????? ?? ????? ??? ??? ???? ????? ????? ????? ?? ???? ?? ????? ???? ??????? ???? ????? ??????? ??? ?? ?????? ??? ???? ?? ???? ?????? ???????. ???? ??? ???? ????? ???? ??????? ???? ????? ???? ?????? ????? ???? ????? ????. ???? ???? ?????? ??? ???? ?????? ??????? ?? ??? ????????? ????????? ????? ????????? ??????? ??????? ?????? ??????? ?????????? ??? ?? ??? ??? ??????? ??????? ?????? ?????? ??? ????? ?? ???? ???? ????? ?????????? ??????? ????????? ?? ???? ????? ??????? ??? ???? ??????? ??????? ??????? ??????? ????? ????????? ????????? ??? ??? ????? ???????? ??? ???? ?????? ?? ???? ????????? ?????????. ???? ?????? ??? ??? ????? ???? ?? ???? ?? ????? ??? ??? ?????? ???? ?????? ?????? ?????? ??????? ??????? ???? ????? ????? ?? ????? ???? ????? ????? ? ??????. ?????? ???? ????? ?????? ???????? ???????? ?????? ???? ??????? ??????? ???? ??? ????? ??????? ????????? ?????? ??? ?? ????? ??? ????? ?????? ?? ???? ???? ?????? ??????? ??????? ???????? ???? ????? ?? ????? ????????. ???? ?????? ?? ??? ?? ???? ????? ???????? ??? ???? ??????? ???? ????? ????? ????? ?? ???? ?? ????? ???? ??????? ???? ?????. ????? ?????? ??????? ??? ?????? ?? ??? ?? ???? ???? ???????? ??????? ???????? ??????? ????? ?????? ??? ???? ???? ????? ????? ????? ?? ???? ?? ????? ???? ?????? ????? ????? ?????? ????? ???? ????? ???????? ?????? ????? ????? ???????? ??? ???? ??????? ?? ????? ???? ?? ????? ?? ?????? ??? ???? ????? ???? ????? ??? ?????? ??????? ???? ???????? ??????? ?????? ???? ??????. ????? ???? ????? ?????? ????? ?? ????? ????????? ???? ??? ??? ?????? ??? ?????? ?????? ????????? ?????? ?????? ?????? ???? ??????? ??????? ???? ???? ?? ??? ??????? ???????? ??? ????? ???? ???????? ??????? ??????? ?????? ?????. ???? ???? ?? ??????? ?????? ??? ????? ??? ?? ???? ?? ????? ???? ???? ???? ??????? ???? ????????? ???????? ???? ??????? ????? ????? ???????? ???? ????? ??? ?????. [term_id] => 7 [news_category] => home-news [news_name] => ???????? [news_key] => source [news_source] => ??? ? ?????? [news_image] => http://test.com//wp-content/uploads/ ) )
please help to post such type of data so that i can receive it same as i post.
Setting Curl header:
$header = array("Content-Type: text/html; charset=UTF-8");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header)
header('Content-Type: text/html; charset=UTF-8');
echo file_get_contents("http://www.emaratalyoum.com/multimedia/videos/2012-04-08-1.474873");