array( 'url' => $image_url, 'caption' => $caption, 'published' => 'true', 'access_token' => QA_FB_PAGE_TOKEN ), 'timeout' => 60 ) );} /* ============================== TWITTER POST============================== */ function qa_post_to_twitter($image_url, $caption) { // STEP 1: Upload media $media_response = qa_twitter_oauth_request( 'https://upload.twitter.com/1.1/media/upload.json', array('media' => base64_encode(file_get_contents($image_url))), 'POST' ); if (empty($media_response->media_id_string)) return; // STEP 2: Post tweet qa_twitter_oauth_request( 'https://api.twitter.com/1.1/statuses/update.json', array( 'status' => $caption, 'media_ids' => $media_response->media_id_string ), 'POST' );} /* ============================== TWITTER OAUTH CORE============================== */ function qa_twitter_oauth_request($url, $params, $method = 'POST') { $oauth = array( 'oauth_consumer_key' => QA_TW_CONSUMER_KEY, 'oauth_token' => QA_TW_ACCESS_TOKEN, 'oauth_nonce' => wp_generate_password(12, false), 'oauth_timestamp' => time(), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_version' => '1.0' ); $base_params = array_merge($oauth, $params); ksort($base_params); $base_string = strtoupper($method) . "&" . rawurlencode($url) . "&" . rawurlencode(http_build_query($base_params, '', '&', PHP_QUERY_RFC3986)); $signing_key = rawurlencode(QA_TW_CONSUMER_SECRET) . '&' . rawurlencode(QA_TW_ACCESS_SECRET); $oauth['oauth_signature'] = base64_encode( hash_hmac('sha1', $base_string, $signing_key, true) ); $header = 'OAuth '; $values = array(); foreach ($oauth as $key => $value) { $values[] = $key . '="' . rawurlencode($value) . '"'; } $header .= implode(', ', $values); $args = array( 'headers' => array('Authorization' => $header), 'body' => $params, 'timeout' => 60 ); $response = wp_remote_request($url, array_merge($args, array('method' => $method))); return json_decode(wp_remote_retrieve_body($response));} CPEC Project – Page 8 – TIMES OF ISLAMABAD
Times of Islamabad

Chinese model to be followed in special economic zones construction: Pak Ambassador

News Desk
2019-01-19

BEIJING: Pakistan will follow the Chinese model in the establishment of its industrial parks and special economic zones in different...

Analysts say completion of CPEC will bring economic, trade and social changes in the region

News Desk
2019-01-19

CPEC is great initiative which is not only beneficial for China and Pakistan but also for the entire region. CPEC...

Senate body reviews facilities of CPEC project in Gwadar

News Desk
2019-01-17

QUETTA: Chairman of Senate Standing Committee for Maritime Affairs Nazhat Sadiq here presided over a meeting to review China-Pak Economic...

Industrial sector to be developed on priority: Asad

News Desk
2019-01-16

Minister for Finance Asad Umar has said that the government is looking forward to take China Pakistan Economic Corridor (CPEC)...

CPEC to usher new era of progress in Balochistan: PM

News Desk
2019-01-16

Prime Minister Imran Khan has expressed the confidence that China Pakistan Economic Corridor project will usher in a new era...

CPEC game changer for country: NA Speaker

News Desk
2019-01-14

Speaker National Assembly Asad Qaiser says China Pakistan Economic Corridor is a game changer for the country whose fruits will...

Saudi delegation visits proposed oil refinery site at Gwadar

News Desk
2019-01-13

GWADAR: A delegation of Saudi Arabia arrived here on Saturday to inspect the site for the proposed oil refinery at...

CPEC backbone for progress, prosperity of Pakistan: Elahi

News Desk
2019-01-11

Chinese Ambassador to Pakistan, Mr. Yao Jing called on Acting Governor of the Punjab Chaudhry Pervaiz Elahi at the Governor’s...

Punjab govt establishing new special economic zones: Buzdar

News Desk
2019-01-11

Chinese Ambassador Mr. Yao Jing called on Punjab Chief Minister Sardar Usman Buzdar in Lahore. On the occasion, different matters...

CPEC can play key role in generating jobs in Pakistan: Global Times

News Desk
2019-01-11

BEIJING: The China-Pakistan Economic Corridor (CPEC) can play a better role in yielding employment benefits for local people if the...

Previous Next